mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 16:53:52 +02:00
refactor: Enable -Wswitch in exhaustive switch
Also, apply the comment according to the dev notes. Also, modify the dev notes to give a lambda-wrapped example. Can be reviewed via --ignore-all-space Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
This commit is contained in:
@@ -42,12 +42,15 @@ static void SignTransactionSingleInput(benchmark::Bench& bench, InputType input_
|
||||
keystore.pubkeys.emplace(key_id, pubkey);
|
||||
|
||||
// Create specified locking script type
|
||||
CScript prev_spk;
|
||||
switch (input_type) {
|
||||
case InputType::P2WPKH: prev_spk = GetScriptForDestination(WitnessV0KeyHash(pubkey)); break;
|
||||
case InputType::P2TR: prev_spk = GetScriptForDestination(WitnessV1Taproot(XOnlyPubKey{pubkey})); break;
|
||||
default: assert(false);
|
||||
}
|
||||
CScript prev_spk = [&]() {
|
||||
switch (input_type) {
|
||||
case InputType::P2WPKH:
|
||||
return GetScriptForDestination(WitnessV0KeyHash(pubkey));
|
||||
case InputType::P2TR:
|
||||
return GetScriptForDestination(WitnessV1Taproot(XOnlyPubKey{pubkey}));
|
||||
} // no default case, so the compiler can warn about missing cases
|
||||
assert(false);
|
||||
}();
|
||||
prev_spks.push_back(prev_spk);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user