- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.2k
refactor: allow wallet to select fresh change address to prevent address reuse in coinjoin createdenoms #6870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
739d9f1
              6ca08f6
              d4044d4
              4800e2f
              cfae1e6
              efc689c
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| Wallet | ||
| ------ | ||
|  | ||
| - Add `-coinjoinfreshchange` option to control change destination behavior | ||
| during CoinJoin denomination creation. By default (flag unset), change is | ||
| sent back to the source address (legacy behavior). When enabled, change is | ||
| sent to a fresh change address to avoid address/public key reuse. (#6870) | ||
|  | ||
|  | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -4,6 +4,7 @@ | |
|  | ||
| #include <coinjoin/util.h> | ||
| #include <policy/fees.h> | ||
| #include <coinjoin/options.h> | ||
|          | ||
| #include <policy/policy.h> | ||
| #include <util/translation.h> | ||
| #include <wallet/fees.h> | ||
|  | @@ -125,8 +126,12 @@ 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; | ||
| // By default, keep legacy behavior: change goes back to the origin address. | ||
| // When -coinjoinfreshchange is enabled, let the wallet select a fresh | ||
| // change destination to avoid address reuse. | ||
| if (!CCoinJoinClientOptions::GetFreshChange()) { | ||
| 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 | ||
|  | ||
Uh oh!
There was an error while loading. Please reload this page.