Commit Graph

13082 Commits

Author SHA1 Message Date
Steven Barclay
69d1e16f5e
Prevent takers from using non-segwit deposit tx inputs
Disallow non-P2WH depositTx inputs from the taker, while continuing to
allow them from the maker, so that offers created pre-v1.5.0 can still
be taken. (After some time, those inputs could be disallowed too.)

This is mainly to prevent mass blackmail attacks, where more victims'
money could be locked up than the DAO could possibly compensate them all
for. (This is probably only an attractive attack for a buyer anyway, at
least with the earlier commits.)
2020-11-19 17:19:14 +00:00
Steven Barclay
5a3b072692
Withhold witnesses in buyer->seller depositTx data, until last step
Strip all input witnesses from the depositTx message fields sent from
the buyer, until the last (DelayedPayoutTxSignatureResponse) message is
sent, where they can be bundled in as an extra field. Since the witness
data doesn't affect the final deposit tx id, the seller does not need to
know it until actually publishing the tx.

In the (fully) segwit case, this allows the buyer to prevent the seller
from publishing the deposit tx until the buyer has a valid, fully signed
delayedPayoutTx. Provide the final witness data in an extra 'depositTx'
field in DelayedPayoutTxSignatureResponse, which the seller can merge
with his depositTx witness block (for his own input signatures).
2020-11-19 17:19:13 +00:00
Steven Barclay
803035bdbb
Add new BuyerFinalizesDelayedPayoutTx task
Improve validation of the buyer's delayed payout tx (both before & after
they get the final DepositTxAndDelayedPayoutTxMessage from the peer), by
finalising it independently of the seller. This is now possible since
their 2-of-2 signature is included in the DelayedPayoutSignatureRequest.
Check that the final delayedPayoutTx received from the seller matches it
byte-for-byte (which actually makes its receipt redundant now).

This also fixes an apparent security bug, where the final validation of
the delayedPayoutTx appears to skip any kind of signature check (only a
deposit tx hash check, which is still necessary).

Finally, optimistically check the deposit tx against the input of the
prepared delayedPayoutTx received from the seller, in the case that the
former is non-malleable (that is, the fully segwit case) and thus has a
stable ID given by the hash of the buyer's preparedDepositTx.
2020-11-19 17:19:13 +00:00
Steven Barclay
f02d5ee216
Send seller's delayedPayoutTx signature to peer ASAP
Include a new 'delayedPayoutTxSellerSignature' field with the prepared
delayed payout tx sent to the buyer, in DelayedPayoutTxSignatureRequest.
This will allow the buyer to compute the final, signed delayedPayoutTx
as early as possible and withhold their deposit tx witness from the
seller until they know they have a valid delayedPayoutTx, preventing its
premature publishing in the fully segwit case. (To be done in a later
commit - for now just save the seller's delayedPayoutTx signature.)

As part of this, run the SellerSignsDelayedPayoutTx trade task at an
earlier step (just after payout tx creation) to make its signature
available to the seller ASAP. Also rename 'delayedPayoutTxSignature' to
'delayedPayoutTxBuyerSignature' in DelayedPayoutTxSignatureResponse.
2020-11-19 17:19:12 +00:00
Steven Barclay
79fa219533
Fix missing segwit case when sanitising preparedDepositTx
Make sure witness data is stripped from the seller's prepared deposit
tx, in addition to ScriptSig data, to prevent the buyer from being able
to publish it prematurely (before having signed the delayed payout tx).
2020-11-19 17:19:07 +00:00
Christoph Atteneder
77aab8a97c
Add error log to get more information on the actual problem 2020-11-19 16:51:45 +01:00
Steven Barclay
88d7d96427
Fix failing OpenOfferManagerTest & PeerManagerTest
These are failing on the tip of release/1.5.0 currently due to extra
validation added to PersistenceManager, causing the build to fail upon
merging upstream. Add missing PersistenceManager.shutDown calls to the
tearDown methods of the affected tests to fix.
2020-11-19 16:47:21 +01:00
Christoph Atteneder
ce265e48b7
Merge pull request #4816 from chimp1984/reduce-persistence-interval
Fix issues with missing persistence for trade state
2020-11-19 16:33:46 +01:00
chimp1984
a4db09fe1d
Move delay for applying mailbox messages inside onInitialized
We need to set addDecryptedDirectMessageListener without
delay as otherwise we could miss direct messages (detected
with localhost testing, with tor its likely slower and
would not have been triggered).
2020-11-19 10:19:48 -05:00
chimp1984
d6f4eed39e
Add requestPersistence call at TradeTask.complete call.
This is not really needed as we call it at each state change of the
trade but gives more redundancy in case we missed one or once
changes are applied and a dev forgets to call it.

Multiple repeated calls do have close to zero costs.
2020-11-19 09:51:06 -05:00
Christoph Atteneder
580387c0b7
Add error log to get more information on the actual problem 2020-11-19 14:58:44 +01:00
Christoph Atteneder
247c82b386
Merge pull request #4820 from oscarguindzberg/fixSignAes
Use AES key for signing when wallet is encrypted
2020-11-19 09:47:26 +01:00
chimp1984
da9b42fb83
Handle potential deposit confirmed state issues
The deposit confirmed state is set after we applied the mailbox messages,
which led to a task failure due wrong phase and the message was not applied.
Further it can be that the wallet is still syncing and the deposit
confirmed state is set in any time in the future.

To fix the first problem we add a bit of delay so that the trade has
been updated when we apply the mailbox messages. A better fix would be to change
the order of the methods but that is a bit tricky to get right and I dont want to
risk that for that release.

The second problem would require a large change to trigger the mailbox
processing based on wallet state. We prefer to be more tolerant with
the expected phase instead so allow the mailbox message to be processed
also in the DEPOSIT_PUBLISHED state.
This has no risks as the payout tx would be invalid anyway if the
buyer has cheated and sent the msg in not confirmed deposit tx state (only
possible with code manipulation).

A better fix would to add a listener for the wallet and process
the mailbox msg once wallet is ready and trade state set, but I
leave that for another PR.
2020-11-19 00:34:40 -05:00
chimp1984
706ec5a2ed
Add null checks for tradeManager
We get called some setter methods from protobuf methods before tradeManager is set.
2020-11-19 00:07:34 -05:00
chimp1984
438a0d8217
Remove requestPersistence in constructor as TradeManager is not set at that moment. 2020-11-18 19:58:20 -05:00
Oscar Guindzberg
5906950e1f
Calculate witness sig with AES key 2020-11-18 18:28:06 -03:00
chimp1984
6fb36dcd41
Add more requestPersistence calls 2020-11-18 12:51:53 -05:00
chimp1984
255460e5d5
Add more requestPersistence for data changes in ProcessModel and TradingPeer 2020-11-18 12:38:39 -05:00
chimp1984
9517f427b6
Refactoring: Extract requestPersistence method 2020-11-18 12:12:59 -05:00
Christoph Atteneder
457257b72a
Merge pull request #4787 from chimp1984/various-monitor-improvements
Various monitor improvements
2020-11-18 11:01:01 +01:00
Christoph Atteneder
29b2c33222
Merge pull request #4814 from jmacxx/improve_account_aging_column
Improve UI/UX for account aging column in 'Offers' section of GUI
2020-11-18 10:41:10 +01:00
Christoph Atteneder
71b6259ed5
Merge pull request #4817 from chimp1984/improve-filter
Improve filter
2020-11-18 10:12:33 +01:00
chimp1984
fa0c28adf6
Add requestPersistence calls
We relied on the shutdwon routine to be called reliably but it seems that is not the case as some bug reports show.
So we call requestPersistence at every write access of the trade object
2020-11-17 22:35:51 -05:00
chimp1984
ccfcc351f4
Clean tor dir at startup 2020-11-17 20:17:44 -05:00
chimp1984
6d7c3ad4dc
Remove dev log 2020-11-17 20:15:54 -05:00
chimp1984
bf2c94160f
Add delay between remove and add new filter
We saw that some seed nodes have 2 filters after filter update.
This should not be the case as the remove is broadcast before the
add but seems there is some issue in the P2P storage which does
not cover that correctly.
By adding a 5 sec delay between the remove and add we mitigate
that issue, though should be fixes in the P2P layer but that
will be a more complex and larger effort.
2020-11-17 20:14:44 -05:00
chimp1984
5b97b97349
Add missing fields in toString method 2020-11-17 20:12:25 -05:00
chimp1984
6fc36d48db
Reduce interval for persistence
Seems the persistence at shutdown is too unsafe and we got bug reports where data was missing.
https://github.com/bisq-network/bisq/issues/4806

Use millisec instead of sec for delay
Rename delayInSec to delay
2020-11-17 19:15:59 -05:00
jmacxx
f7fac0f3c4
code review change: curlies & whitespace for if statement 2020-11-16 16:15:57 -06:00
jmacxx
dd26077caa
Improve UI/UX for account aging column in 'Offers' section of GUI
Showing 'x' days until limits lifted (signed, pending)
Showing clock icon (signed, pending)
Showing outlined check icon (aging accounts)
Showing account age (unsigned or aging)
Changed column name from 'Signed since' to 'Account info'

Fixed bug when switching between altcoins and fiat order books
the account info column was being added back to the table in
the wrong position.
2020-11-16 10:44:01 -06:00
sqrrm
c1287ac43a
Merge pull request #4804 from chimp1984/improve-persistence-manager
Improve persistence manager
2020-11-14 22:30:09 +01:00
chimp1984
755ea4d792
Add missing initCalled.set(true); 2020-11-14 15:51:51 -05:00
sqrrm
627e0671b6
Merge pull request #4792 from ripcurlx/update-data-stores-for-v1.5.0
Update data stores for v1.5.0
2020-11-14 12:56:23 +01:00
chimp1984
a64c11ebe4
Add additional guards to ensure that the shut down routine is not called multiple times
(which can happen in rare cases) and add guards that we never create multiple instances
for a given file as well not call initialize or other API methods after shutdown was started.
2020-11-13 14:08:01 -05:00
Christoph Atteneder
61c8d55a6f
Merge pull request #4791 from wiz/remove-legacy-bsq-explorers
Remove legacy BSQ explorers
2020-11-13 14:07:02 +01:00
wiz
fcf7de611a
Remove legacy BSQ explorers 2020-11-13 13:45:19 +01:00
wiz
2520901350
Temporarily disable wiz's monero explorer node
Will re-enable later after making a new monero node on a new server
2020-11-13 13:45:07 +01:00
Christoph Atteneder
c7c218e1d2
Merge pull request #4790 from wiz/disable-wiz-monero-explorer
Temporarily disable wiz's monero explorer node
2020-11-13 13:43:07 +01:00
wiz
5a08c8b7ba
Remove legacy BSQ explorers 2020-11-13 21:29:36 +09:00
wiz
c2baf3fa7d
Temporarily disable wiz's monero explorer node
Will re-enable later after making a new monero node on a new server
2020-11-13 21:03:30 +09:00
Christoph Atteneder
19432e4a1e
Update data stores for v1.5.0 2020-11-13 13:00:46 +01:00
Christoph Atteneder
3e5bf90bdd
Update release process to match new trade statistics delivery
Also did some minor release process cleanup that was overdue
2020-11-13 12:29:29 +01:00
Christoph Atteneder
37be138830
Update bitcoinj checkpoints for v1.5.0 2020-11-13 12:29:29 +01:00
Christoph Atteneder
b4a4f48f3a
Merge pull request #4786 from chimp1984/fix-historical-data-store-issue
Fix historical data store issue
2020-11-13 12:19:01 +01:00
Christoph Atteneder
4eb43d7975
Merge pull request #4788 from chimp1984/add-amazon-gift-cards
Add Amazon eGift Card payment method
2020-11-13 09:16:20 +01:00
chimp1984
a238c205ab
Add Amazon eGift Card payment method 2020-11-13 00:26:23 -05:00
chimp1984
ee5fca9532
Revert timeout changes and MAX_PERMITTED_MESSAGE_SIZE change 2020-11-12 16:01:30 -05:00
chimp1984
2b807769d4
Update commit hash to 7f83d1b3 2020-11-12 15:58:58 -05:00
chimp1984
8bc78c852b
Cleanup tor dir if all connections lost 2020-11-12 15:58:58 -05:00
chimp1984
2486bd512f
Shut down if more then 1 all connections lost events 2020-11-12 15:58:58 -05:00