[bisq-network/bitcoinj] Wallet: clone transaction before committing (#38)
chimp1984
notifications at github.com
Thu Oct 21 15:13:29 CEST 2021
@chimp1984 approved this pull request.
utACK
Take my utACK with caution. Not familiar much with BitcoinJ and not sure if there would be a better way to make sure deleting would work on Windows. But I guess its acceptable to get the test on windows ok.
> @@ -1891,7 +1891,14 @@ public void receivePending(Transaction tx, @Nullable List<Transaction> dependenc
return;
if (isTransactionRisky(tx, dependencies) && !acceptRiskyTransactions) {
// isTransactionRisky already logged the reason.
- riskDropped.put(tx.getTxId(), tx);
+
+ // Clone transaction to avoid multiple wallets pointing to the same transaction. This can happen when
+ // two wallets depend on the same transaction.
+ Transaction cloneTx = tx.getParams().getDefaultSerializer().makeTransaction(tx.bitcoinSerialize());
+ cloneTx.setPurpose(tx.getPurpose());
+ cloneTx.setUpdateTime(tx.getUpdateTime());
Are there any other properties we need to move over to the cloneTx?
Maybe avoid code duplication at line 1913 and use a method for getting the clone from the tx?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bitcoinj/pull/38#pullrequestreview-781495095
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20211021/33ce90f1/attachment.htm>
More information about the bisq-github
mailing list