<p>When creating a BSQ transaction (actually at commit time as we can create a tx and then<br>
cancel it in the confirmation popup) we store the change output (only that not the other<br>
possible BSQ output) in a persisted list. The BsqCoinSelector will take that list to<br>
allow spending those coins. We use the txType to find the index of the cahnge output.<br>
We only have one change output in the transactions created in Bisq. Multiple change<br>
outputs would be valid but our goal is only increased usability in the Bisq app and it is<br>
not related to validation rules.</p>
<p>We update out list at each new block confirmation.</p>
<p>With that approach we avoid too much dependencies to the BitcoinJ side.</p>
<ul>
<li>Add UnconfirmedBsqChangeOutputListService and persisted UnconfirmedBsqChangeOutputList<br>
for storing unconfirmed outputs</li>
<li>Add lookup for unconfirmed BSQ change outputs at BsqCoinSelector and allow spending if<br>
found</li>
<li>Pass TxType for walletsManager.publishAndCommitBsqTx calls</li>
<li>Add TxType to bsqWalletService.commitTx</li>
<li>Refactor getPreparedSendTx methods for BSQ and BTC sending to one common method with a<br>
coinselector parameter.</li>
<li>Add getChangeAddress method to BsqWalletService to make change outputs more explicit</li>
<li>Add unconfirmedChangeBalance to onUpdateBalances handlers</li>
<li>Rename availableBalance to availableConfirmedBalance in onUpdateBalances</li>
<li>Unify onUpdateBalances parameter names</li>
</ul>

<hr>

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

<h4>Commit Summary</h4>
<ul>
  <li>Allow spending of unconfirmed BSQ change outputs</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-0">common/src/main/proto/pb.proto</a>
    (11)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-1">core/src/main/java/bisq/core/btc/listeners/BsqBalanceListener.java</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-2">core/src/main/java/bisq/core/btc/wallet/BsqCoinSelector.java</a>
    (26)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-3">core/src/main/java/bisq/core/btc/wallet/BsqWalletService.java</a>
    (80)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-4">core/src/main/java/bisq/core/btc/wallet/WalletService.java</a>
    (9)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-5">core/src/main/java/bisq/core/btc/wallet/WalletsManager.java</a>
    (5)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-6">core/src/main/java/bisq/core/dao/DaoModule.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-7">core/src/main/java/bisq/core/dao/governance/asset/AssetService.java</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-8">core/src/main/java/bisq/core/dao/governance/blindvote/MyBlindVoteListService.java</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-9">core/src/main/java/bisq/core/dao/governance/bond/lockup/LockupTxService.java</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-10">core/src/main/java/bisq/core/dao/governance/bond/unlock/UnlockTxService.java</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-11">core/src/main/java/bisq/core/dao/governance/proofofburn/ProofOfBurnService.java</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-12">core/src/main/java/bisq/core/dao/governance/proposal/MyProposalListService.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-13">core/src/main/java/bisq/core/dao/governance/votereveal/VoteRevealService.java</a>
    (3)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-14">core/src/main/java/bisq/core/dao/state/unconfirmed/UnconfirmedBsqChangeOutputList.java</a>
    (66)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-15">core/src/main/java/bisq/core/dao/state/unconfirmed/UnconfirmedBsqChangeOutputListService.java</a>
    (194)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-16">core/src/main/java/bisq/core/dao/state/unconfirmed/UnconfirmedTxOutput.java</a>
    (113)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-17">core/src/main/java/bisq/core/offer/OfferUtil.java</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-18">core/src/main/java/bisq/core/offer/placeoffer/tasks/CreateMakerFeeTx.java</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-19">core/src/main/java/bisq/core/proto/persistable/CorePersistenceProtoResolver.java</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-20">core/src/main/java/bisq/core/setup/CorePersistedDataHost.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-21">core/src/main/java/bisq/core/trade/protocol/tasks/taker/CreateTakerFeeTx.java</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-22">desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationView.java</a>
    (7)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-23">desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java</a>
    (7)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-24">desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java</a>
    (7)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-25">desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-26">desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java</a>
    (10)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-27">desktop/src/main/java/bisq/desktop/main/dao/wallet/BsqBalanceUtil.java</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-28">desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java</a>
    (34)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-29">desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.java</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-30">desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java</a>
    (5)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-31">desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-32">desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-33">desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/2482/files#diff-34">desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java</a>
    (2)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq/pull/2482.patch'>https://github.com/bisq-network/bisq/pull/2482.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq/pull/2482.diff'>https://github.com/bisq-network/bisq/pull/2482.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/bisq/pull/2482">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AkpZtq_-YwnoNJxz5MocMO2iapJvFEfCks5vSKtLgaJpZM4bYQEC">mute the thread</a>.<img src="https://github.com/notifications/beacon/AkpZtjbnYewnsvalZy15J9W_nKV6EOjRks5vSKtLgaJpZM4bYQEC.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/bisq-network/bisq","title":"bisq-network/bisq","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/bisq-network/bisq"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Allow spending of unconfirmed BSQ change outputs (#2482)"}],"action":{"name":"View Pull Request","url":"https://github.com/bisq-network/bisq/pull/2482"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/2482",
"url": "https://github.com/bisq-network/bisq/pull/2482",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>