Fix trade withdraw to external wallet step 4 #4260
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The routine
cleanUpAddressEntries
in TradeManager was prematurely releasing funds associated with trades when they reach the last step of the process (Step 4, Withdraw to External Wallet).Usually, with a single trade active this would not be an issue because
cleanUpAddressEntries
is called after the withdrawal, but if you have more than one trade at Step 4 then the first withdrawal would go though, but all the others would fail with an error box "Missing x.xxx BTC" (the trade proceeds or deposit amount). Alternatively, if you restart the bisq app with atrade in Step 4, the same cleanup will occur and the attempt to withdraw to external wallet will fail.
The change here considers any trade held by the TradeManager to be in use and therefore will not have their associated address entries freed up. After Step 4 has passed, the trade is no
longer held by the TradeManager, and so
cleanUpAddressEntries
will at that point free up the address.Fixes #4205
Fixes #3592