Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Mar 14, 2022

Passing around a single randomness context shouldn't come with any downsides, but documents better where randomness is used and allows the unit test to be deterministic, if they wish to be so.

@maflcko maflcko changed the title wallet: Pass FastRandomContext& to DiscourageFeeSniping wallet: Use single FastRandomContext when creating a wallet tx Mar 14, 2022
@maflcko maflcko added the Wallet label Mar 14, 2022
@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 14, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #24494 (wallet: generate random change target for each tx for better privacy by glozow)
  • #24213 (refactor: use Span in random.*; make GetRand a template, remove GetRandInt by PastaPastaPasta)
  • #24128 (wallet: BIP 326 sequence based anti-fee-snipe for taproot inputs by MarcoFalke)
  • #23475 (wallet: add config to prioritize a solution that doesn't create change in coin selection by brunoerg)
  • #23076 (Pass CFeeRate and CTxMemPool in-params by reference to const by jonatack)
  • #20640 (wallet, refactor: return out-params of CreateTransaction() as optional struct by theStack)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK fa7deaa.

@@ -191,16 +191,14 @@ std::optional<SelectionResult> SelectCoinsSRD(const std::vector<OutputGroup>& ut
return std::nullopt;
}

static void ApproximateBestSubset(const std::vector<OutputGroup>& groups, const CAmount& nTotalLower, const CAmount& nTargetValue,
static void ApproximateBestSubset(FastRandomContext& insecure_rand, const std::vector<OutputGroup>& groups, const CAmount& nTotalLower, const CAmount& nTargetValue,
Copy link
Contributor

@promag promag Mar 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, any reason to be the 1st arg?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't be the last arg, because that requires a default value, so I picked the "least-last" arg (aka first)

Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

light code review ACK fa7deaa

@achow101
Copy link
Member

ACK fa7deaa

@achow101 achow101 merged commit 3ab96f2 into bitcoin:master Mar 23, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 24, 2022
@maflcko maflcko deleted the 2203-RandWallet-🗾 branch March 24, 2022 08:21
@bitcoin bitcoin locked and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants