Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/release-notes-6870.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Wallet
------

- CoinJoin denomination creation now respects the wallet's "avoid_reuse"
setting. When the wallet has `avoid_reuse` enabled, change is sent to a
fresh change address to avoid address/public key reuse. Otherwise, change
goes back to the source address (legacy behavior). (#6870)


10 changes: 8 additions & 2 deletions src/coinjoin/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <wallet/fees.h>
#include <wallet/spend.h>
#include <wallet/wallet.h>
#include <wallet/walletutil.h>

#include <numeric>

Expand Down Expand Up @@ -125,8 +126,13 @@ CTransactionBuilder::CTransactionBuilder(CWallet& wallet, const CompactTallyItem
coinControl.m_discard_feerate = ::GetDiscardRate(m_wallet);
// Generate a feerate which will be used by calculations of this class and also by CWallet::CreateTransaction
coinControl.m_feerate = std::max(GetRequiredFeeRate(m_wallet), m_wallet.m_pay_tx_fee);
// Change always goes back to origin
coinControl.destChange = tallyItemIn.txdest;
// If wallet does not have the avoid-reuse feature enabled, keep legacy
// behavior: force change to go back to the origin address. When
// WALLET_FLAG_AVOID_REUSE is enabled, let the wallet select a fresh
// change destination to avoid address reuse.
if (!m_wallet.IsWalletFlagSet(wallet::WALLET_FLAG_AVOID_REUSE)) {
coinControl.destChange = tallyItemIn.txdest;
}
// Only allow tallyItems inputs for tx creation
coinControl.m_allow_other_inputs = false;
// Create dummy tx to calculate the exact required fees upfront for accurate amount and fee calculations
Expand Down
Loading