Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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)


1 change: 1 addition & 0 deletions src/coinjoin/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ void CCoinJoinClientOptions::SetDenomsHardCap(int denoms_hardcap)
options.nCoinJoinDenomsHardCap = denoms_hardcap;
}


void CCoinJoinClientOptions::Init()
{
assert(!CCoinJoinClientOptions::_instance);
Expand Down
11 changes: 9 additions & 2 deletions src/coinjoin/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <coinjoin/options.h>
#include <coinjoin/util.h>
#include <policy/fees.h>
#include <policy/policy.h>
#include <util/translation.h>
#include <wallet/fees.h>
#include <wallet/spend.h>
#include <wallet/wallet.h>
#include <wallet/walletutil.h>

#include <numeric>

Expand Down Expand Up @@ -125,8 +127,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
1 change: 1 addition & 0 deletions src/wallet/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ void WalletInit::AddWalletOptions(ArgsManager& argsman) const
argsman.AddArg("-coinjoinmultisession", strprintf("Enable multiple CoinJoin mixing sessions per block, experimental (0-1, default: %u)", DEFAULT_COINJOIN_MULTISESSION), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET_COINJOIN);
argsman.AddArg("-coinjoinrounds=<n>", strprintf("Use N separate masternodes for each denominated input to mix funds (%u-%u, default: %u)", MIN_COINJOIN_ROUNDS, MAX_COINJOIN_ROUNDS, DEFAULT_COINJOIN_ROUNDS), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET_COINJOIN);
argsman.AddArg("-coinjoinsessions=<n>", strprintf("Use N separate masternodes in parallel to mix funds (%u-%u, default: %u)", MIN_COINJOIN_SESSIONS, MAX_COINJOIN_SESSIONS, DEFAULT_COINJOIN_SESSIONS), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET_COINJOIN);


#ifdef USE_BDB
argsman.AddArg("-dblogsize=<n>", strprintf("Flush wallet database activity from memory to disk log every <n> megabytes (default: %u)", DatabaseOptions().max_log_mb), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST);
Expand Down
Loading