Commit Graph

984 Commits

Author SHA1 Message Date
catbref
190014cf96 Fix minor NPE during shutdown 2021-01-16 13:20:20 +00:00
catbref
385064e324 Return foreign-chain wallet transactions in newest-timestamp-first order 2021-01-08 17:37:12 +00:00
catbref
f3e1f088f8 Bump to v1.4.0 2021-01-07 07:49:13 +00:00
catbref
6eb9447bb9 Merge branch 'LTCv3-with-presence' into master 2021-01-07 07:45:47 +00:00
catbref
0ee8d7da0f Improve removal of expired PRESENCE txns in websocket cache 2020-12-31 11:26:13 +00:00
catbref
918a331609 Transaction.importAsUnconfirmed() now BLOCKS for blockchain lock, instead of non-blocking try()
This is a serious change as it affects many callers.

Controller.onNetworkTransactionMessager()
-- should be OK to block as it's only one EPC thread

TransactionsResource.processTransaction()
-- should be OK to block as it's only one Jetty thread
AND has its own 30s timeout wrapper anyway

Implementations of AcctTradeBot.progress()
e.g. BitcoinACCTv1TradeBot.progress() & LitecoinACCTv1TradeBot.progress()
TradeBot.updatePresence()
-- these are called via BlockMinter/Synchronizer
when blockchain lock is already held, so will are unaffected

AcctTradeBot.createTrade() and AcctTradeBot.startResponse()
-- these are called via API
and previously would only perform non-blocking blockchainLock.try()
but now perform blocking blockchainLock.lock()
thus preventing NO_BLOCKCHAIN_LOCK when creating/responding to trades
especially after a (wasted) MESSAGE PoW compute
but with potential downside that API response might be delayed
e.g. by a very slow sync round

Future work could look into removing the need for blockchain lock
when calling Transaction.importAsUnconfirmed().
2020-12-30 12:43:41 +00:00
catbref
9bc395d36f Bump to v1.3.9 2020-12-29 17:59:02 +00:00
catbref
41453f5bd1 Add primary key index to latest AT state cache for extra speed! 2020-12-29 17:57:20 +00:00
catbref
78f62751e5 TESTNET ONLY: Correct "LitcoinACCTv1" TradeBotStates.acct_name values in DB 2020-12-29 14:16:47 +00:00
catbref
d59c30757c Fix conversion of double in ElectrumX JSON to long 2020-12-29 12:17:55 +00:00
catbref
30d2e4fdac Correct logging message to blockchain-agnostic text 2020-12-29 12:16:40 +00:00
catbref
d43a074cc1 Use *ACCT*.class.getSimpleName() for less error-prone ACCT.NAME 2020-12-29 11:00:43 +00:00
catbref
27783dc6de Add WARNING on start-up if repository is missing latest AT state data 2020-12-29 10:34:25 +00:00
catbref
2a789a9a9b Add WARNING on start-up if repository is missing latest AT state data 2020-12-29 10:15:56 +00:00
catbref
a66dba767e Fix incorrect LatestATStates SQL table definition
This table was previously defined using the TEMPORARY keyword as the rows were used as a cached/index to speed up AT trimming SQL statements.

However, the table definition was lacking the "ON COMMIT PRESERVE ROWS" clause, and possibly the "GLOBAL" keyword, which caused the table contents to be emptied, immediately after being filled, when <tt>repository.saveChanges()</tt> was called (i.e. "COMMIT").

This caused latest AT states to be trimmed in error.

AtRepositoryTests.testGetLatestATStatePostTrimming also fixed so that it fails with the previous, broken code.
2020-12-29 09:19:03 +00:00
catbref
e00579e1a2 Fix incorrect LatestATStates SQL table definition
This table was previously defined using the TEMPORARY keyword as the rows were used as a cached/index to speed up AT trimming SQL statements.

However, the table definition was lacking the "ON COMMIT PRESERVE ROWS" clause, and possibly the "GLOBAL" keyword, which caused the table contents to be emptied, immediately after being filled, when <tt>repository.saveChanges()</tt> was called (i.e. "COMMIT").

This caused latest AT states to be trimmed in error.

AtRepositoryTests.testGetLatestATStatePostTrimming also fixed so that it fails with the previous, broken code.
2020-12-29 09:11:11 +00:00
catbref
99f1a55de2 Improve logging for case where trade offer is locked to someone else 2020-12-29 08:56:26 +00:00
catbref
3ec307a2a1 Don't allow more than one (active) trade-bot entry per trade-offer 2020-12-28 15:55:14 +00:00
catbref
3fdef9ea6d Fix P2SH refund "non-final" error issue
According to Bitcoin source, CheckFinalTx() in validation.cpp ~line 223,
we need to make sure median blocktime has passed P2SH refund transaction's
nLockTime.

Previously we were erroneously checking that median blocktime was in the past.

This should fix issues where refunding P2SH results in a "non-final" error
from the ElectrumX server network.
2020-12-28 15:44:45 +00:00
catbref
332c917c94 Fix ALICE-based PRESENCE transactions.
PRESENCE transactions were previously validated using Bob's trade key (in address form).
But as PRESENCE transactions are already emitted by Alice, her trade key is also used
(if present in trade data by virtue of AT being locked to Alice).

Similarly, Alice's trade-bot won't even try to build PRESENCE transactions if her
trade key isn't publicly visible to other peers, i.e. after AT is locked to Alice.
2020-12-28 12:00:11 +00:00
catbref
35b0ac78b8 Bump ElectrumX transaction cache size from 100 to 200 2020-12-24 16:52:58 +00:00
catbref
047627a6e5 Force bitcoinj keychain lookaheadThreshold to zero so we always generate more keys 2020-12-24 16:48:47 +00:00
catbref
e4e775a107 Bump to v1.3.8 2020-12-24 12:09:30 +00:00
catbref
5d6811bd50 Workaround for block 212937 issue 2020-12-23 15:02:14 +00:00
catbref
688f215dfd Allow PresenceType filtering on presence websocket via presenceType query param 2020-12-21 12:25:58 +00:00
catbref
7cbdbbcc8d Allow exception-free conversion from String to PresenceType 2020-12-21 12:25:11 +00:00
catbref
4e89b8fbac No need to create a map entry for null foreignBlockchain in TradeOffersWebSocket 2020-12-21 12:24:44 +00:00
catbref
70ec8cb11f Add public key in Qortal address form to tradeoffers and presence websockets
This aids matching PRESENCE to corresponding trade offers for use in UI.

Also tighten up visibility of some fields in ChainChainOfferSummary and
PresenceInfo to private.

PresenceInfo.address should map to CrossChainOfferSummary.qortalCreatorTradeAddress
which is "AT creator's ephemeral trading key-pair represented as Qortal address"
2020-12-18 11:42:53 +00:00
catbref
0f0266609f Add trading price estimate API call GET /crosschain/price/{blockchain} where blockchain is something like LITECOIN 2020-12-18 11:42:32 +00:00
catbref
ecfa6e994e Add API call POST /admin/repository/backup to trigger immediate backup 2020-12-16 12:52:19 +00:00
catbref
ed4a45f214 Force blocking DB backup to improve integrity of backup files 2020-12-16 12:51:30 +00:00
catbref
e953be6e4a In pom.xml, have Maven surefire plugin skip tests by default 2020-12-14 15:25:53 +00:00
catbref
bd51806a0d Improve Block.getBytesForMinterSignature() 2020-12-14 15:05:31 +00:00
catbref
625dbfbbd7 Unify BlockInfo into BlockSummaryData, removing minterAddress (unused) and extra repository calls 2020-12-14 13:13:44 +00:00
catbref
1c6ea0a860 Improvements to ElectrumX, Bitcoin-y aspects, etc.
Add caching of transactions fetched via ElectrumX to reduce network load and speed up API response.

Fix handling ElectrumX servers that don't want to supply verbose transaction JSON.

Hide lots of data in BitcoinyTransaction that isn't needed by current API users.
2020-12-11 17:30:15 +00:00
catbref
3706cd5ff7 Return list, not set, of wallet transactions via API and provide better (usable) examples 2020-12-11 17:29:00 +00:00
catbref
934cd1d511 Add support for preferred blockchain to /websockets/crosschain/tradebot via foreignBlockchain query param 2020-12-10 17:08:32 +00:00
catbref
68e3d3b989 Add preferred-blockchain filtering to /websockets/crosschain/tradeoffers via foreignBlockchain query param 2020-12-10 16:00:01 +00:00
catbref
31fa916156 Add filtering by foreign blockchain to API crosschain calls 2020-12-10 14:52:06 +00:00
catbref
456bb3ca63 Include output addresses, if present, in BitcoinyTransaction 2020-12-10 14:01:40 +00:00
catbref
b07ad094c1 Fix DELETE /crosschain/tradebot by adding missing repository.saveChanges() 2020-12-10 13:11:48 +00:00
catbref
d766cfaa67 Fix API/websockets that were still BitcoinACCTv1-only 2020-12-10 12:48:46 +00:00
catbref
acc616c204 Add defensive code to EventBus to catch unexpected exceptions 2020-12-10 11:55:06 +00:00
catbref
8707f154ee Add support to ElectrumX for barring servers that don't give us the data we need 2020-12-10 11:32:09 +00:00
catbref
992427f0e0 Fix NPE due to unboxing null/no entry from PREVIOUS_STATES.get() in TradeBotWebSocket. Usually triggered when creating new trade-bot entry while having open websocket connection. 2020-12-10 11:31:37 +00:00
catbref
2c84add935 Bitcoiny improvements 2020-12-09 13:12:15 +00:00
catbref
e8fc91fd34 Minor work on ByteArray and associated tests 2020-12-08 15:19:12 +00:00
catbref
8c9cf4a02d Add API support for listing Bitcoin/Litecoin wallet transactions 2020-12-07 16:40:12 +00:00
catbref
23f0969b2d Requesting BTC/LTC wallet balance now accepts public key xpub/tpub too 2020-12-07 15:40:05 +00:00
catbref
cf82813280 Report foreignBlockchain and acctName in results for API call GET /crosschain/tradeoffers 2020-12-02 14:37:50 +00:00