Merge UP TO 48174c0f28 into merged_master (UP TO Bitcoin PR bitcoin/bitcoin#26240)

FIXME in wallet_taproot.py functional test

1668424146 2022-11-14T12:09:06+01:00 48174c0f28 Bitcoin Merge bitcoin/bitcoin#26240: rpc: Adjust RPCTypeCheckObj error string
1668417474 2022-11-14T10:17:54+01:00 59e00c7e03 Bitcoin Merge bitcoin/bitcoin#25714: univalue: Avoid std::string copies
1668111238 2022-11-10T15:13:58-05:00 7ef730ca84 Bitcoin Merge bitcoin/bitcoin#26483: test: Don't pass add_to_wallet option to walletcreatefundedpsbt
1668004459 2022-11-09T15:34:19+01:00 9dce30194b Bitcoin Merge bitcoin/bitcoin#26472: test: add missing bech32m / BIP86 test-cases to wallet_descriptor.py
1667992471 2022-11-09T12:14:31+01:00 44ca5d5e87 Bitcoin Merge bitcoin/bitcoin#26473: test: Avoid collision with valid path names in `getarg_tests/logargs`
1667640759 2022-11-05T10:32:39+01:00 50422b770a Bitcoin Merge bitcoin/bitcoin#26419: log: mempool: log removal reason in validation interface
1667636699 2022-11-05T09:24:59+01:00 ce57dbac90 Bitcoin Merge bitcoin/bitcoin#26449: rpc: doc: add missing option "bech32m" for `change_type` parameters
1667577253 2022-11-04T15:54:13+00:00 ae6bb6e71e Bitcoin Merge bitcoin/bitcoin#26418: Fix signing of multi_a and rawtr scripts with wallets that only have corresponding keys
This commit is contained in:
Byron Hambly 2025-02-27 14:50:01 +02:00
commit 7ea69ff0d8
No known key found for this signature in database
GPG key ID: DE8F6EA20A661697
18 changed files with 193 additions and 114 deletions

View file

@ -2509,14 +2509,23 @@ TransactionError DescriptorScriptPubKeyMan::FillPSBT(PartiallySignedTransaction&
keys->Merge(std::move(*script_keys));
} else {
// Maybe there are pubkeys listed that we can sign for
script_keys = std::make_unique<FlatSigningProvider>();
for (const auto& pk_pair : input.hd_keypaths) {
const CPubKey& pubkey = pk_pair.first;
std::unique_ptr<FlatSigningProvider> pk_keys = GetSigningProvider(pubkey);
if (pk_keys) {
keys->Merge(std::move(*pk_keys));
}
std::vector<CPubKey> pubkeys;
// ECDSA Pubkeys
for (const auto& [pk, _] : input.hd_keypaths) {
pubkeys.push_back(pk);
}
// Taproot output pubkey
std::vector<std::vector<unsigned char>> sols;
if (Solver(script, sols) == TxoutType::WITNESS_V1_TAPROOT) {
sols[0].insert(sols[0].begin(), 0x02);
pubkeys.emplace_back(sols[0]);
sols[0][0] = 0x03;
pubkeys.emplace_back(sols[0]);
}
// Taproot pubkeys
for (const auto& pk_pair : input.m_tap_bip32_paths) {
const XOnlyPubKey& pubkey = pk_pair.first;
for (unsigned char prefix : {0x02, 0x03}) {
@ -2524,10 +2533,14 @@ TransactionError DescriptorScriptPubKeyMan::FillPSBT(PartiallySignedTransaction&
std::copy(pubkey.begin(), pubkey.end(), b + 1);
CPubKey fullpubkey;
fullpubkey.Set(b, b + 33);
std::unique_ptr<FlatSigningProvider> pk_keys = GetSigningProvider(fullpubkey);
if (pk_keys) {
keys->Merge(std::move(*pk_keys));
}
pubkeys.push_back(fullpubkey);
}
}
for (const auto& pubkey : pubkeys) {
std::unique_ptr<FlatSigningProvider> pk_keys = GetSigningProvider(pubkey);
if (pk_keys) {
keys->Merge(std::move(*pk_keys));
}
}
}