diff options
author | fanquake <fanquake@gmail.com> | 2023-09-07 16:10:34 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-09-07 16:22:16 +0100 |
commit | 238d29aff9b43234e340a9cf17742b2be5d1e97d (patch) | |
tree | 9a7d8a19ab1d10f0f2114e826340366e5c088c0d /src/clientversion.h | |
parent | 0354206a3004199648784e16eef60d2ef4d69e17 (diff) | |
parent | 1580e3be83bd03985b2f288ed70de510903068d9 (diff) |
Merge bitcoin/bitcoin#28361: fuzz: add ConstructPubKeyBytes util function
1580e3be83bd03985b2f288ed70de510903068d9 fuzz: add ConstructPubKeyBytes function (josibake)
Pull request description:
In https://github.com/bitcoin/bitcoin/pull/28246 and https://github.com/bitcoin/bitcoin/pull/28122 , we add a `PubKeyDestination` and a `V0SilentPaymentsDestination`. Both of these PRs update `fuzz/util.cpp` and need a way to create well-formed pubkeys. Currently in `fuzz/util.cpp`, we have some logic for creating pubkeys in the multisig data provider. This logic is duplicated in #28246 and duplicated again in #28122. Seems much better to have a `ConstructPubKeyBytes` function that both PRs (and any future work) can reuse.
This PR introduces a function to do this and has the existing code use it. While the purpose is to introduce a utility function, the previous multisig code used `ConsumeIntegralInRange(4, 7)` which would have created some uncompressed pubkeys with the prefix 0x05, which is incorrect (see https://bitcoin.stackexchange.com/questions/57855/c-secp256k1-what-do-prefixes-0x06-and-0x07-in-an-uncompressed-public-key-signif)
tldr; using `PickValueFromArray` is more correct as it limits to the set of defined prefixes for compressed and uncompressed pubkeys.
ACKs for top commit:
Sjors:
ACK 1580e3be83bd03985b2f288ed70de510903068d9
Tree-SHA512: c87c8bcd1f6b3a97ef772be93102efb912811c59f32211cfd531a116f1da8a57c8c6ff106b34f2a2b88d8b34fb5bc30d9f9ed6d2720113ffcaaa2f8d5dc9eb27
Diffstat (limited to 'src/clientversion.h')
0 files changed, 0 insertions, 0 deletions