<p>Problem: A transaction received from the network is added to all wallets<br>
that find it relevant. If two wallets find the same transaction relevant<br>
the same Transaction instance is added to both wallets.</p>
<p>Spending the outputs from this transaction can cause consistiency<br>
issues, in particular if the outputs are spent in the same transaction,<br>
as shown in WalletTest.oneTxTwoWallets. There are probably more issues<br>
with having the same Transaction instance handled by two different<br>
wallets.</p>
<p>Fix: Clone the transaction before adding it to the wallet.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/bisq-network/bitcoinj/pull/38'>https://github.com/bisq-network/bitcoinj/pull/38</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/bisq-network/bitcoinj/pull/38/commits/d6e6f397738bc0f9f489640175067439120a9cf9">Wallet: clone transaction before committing</a></li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bitcoinj/pull/38/files#diff-a2b6e1494960b94ec06cea180f8c1ec0fd51cfefa7e0ecb11f7ab5e0133bcbbc">core/src/main/java/org/bitcoinj/wallet/Wallet.java</a>
    (18)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bitcoinj/pull/38/files#diff-bb1ab979b5e42fe814e4e71d3e9fb413fc944bd8c82ebd057d1c6ceab1fe1013">core/src/test/java/org/bitcoinj/wallet/WalletTest.java</a>
    (68)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bitcoinj/pull/38.patch'>https://github.com/bisq-network/bitcoinj/pull/38.patch</a></li>
  <li><a href='https://github.com/bisq-network/bitcoinj/pull/38.diff'>https://github.com/bisq-network/bitcoinj/pull/38.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bitcoinj/pull/38">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNSHEBAL36SSBZC2A5LUDHIZ7ANCNFSM5ERJJZAA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/AJFFTNXJP5PWM42AIQVKJ5DUDHIZ7A5CNFSM5ERJJZAKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4O64D3LQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bitcoinj/pull/38",
"url": "https://github.com/bisq-network/bitcoinj/pull/38",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>