mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 18:20:58 +02:00
refactor: Avoid copies in FlatSigningProvider Merge
This commit is contained in:
@ -644,7 +644,7 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out,
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Unable to parse descriptor '%s': %s", desc_str, error));
|
||||
}
|
||||
desc->Expand(0, desc_out, scripts_temp, desc_out);
|
||||
coinControl.m_external_provider = Merge(coinControl.m_external_provider, desc_out);
|
||||
coinControl.m_external_provider.Merge(std::move(desc_out));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2080,7 +2080,7 @@ std::unique_ptr<FlatSigningProvider> DescriptorScriptPubKeyMan::GetSigningProvid
|
||||
// Fetch SigningProvider from cache to avoid re-deriving
|
||||
auto it = m_map_signing_providers.find(index);
|
||||
if (it != m_map_signing_providers.end()) {
|
||||
*out_keys = Merge(*out_keys, it->second);
|
||||
out_keys->Merge(FlatSigningProvider{it->second});
|
||||
} else {
|
||||
// Get the scripts, keys, and key origins for this script
|
||||
std::vector<CScript> scripts_temp;
|
||||
@ -2117,7 +2117,7 @@ bool DescriptorScriptPubKeyMan::SignTransaction(CMutableTransaction& tx, const s
|
||||
if (!coin_keys) {
|
||||
continue;
|
||||
}
|
||||
*keys = Merge(*keys, *coin_keys);
|
||||
keys->Merge(std::move(*coin_keys));
|
||||
}
|
||||
|
||||
return ::SignTransaction(tx, keys.get(), coins, sighash, input_errors);
|
||||
@ -2178,7 +2178,7 @@ TransactionError DescriptorScriptPubKeyMan::FillPSBT(PartiallySignedTransaction&
|
||||
std::unique_ptr<FlatSigningProvider> keys = std::make_unique<FlatSigningProvider>();
|
||||
std::unique_ptr<FlatSigningProvider> script_keys = GetSigningProvider(script, sign);
|
||||
if (script_keys) {
|
||||
*keys = Merge(*keys, *script_keys);
|
||||
keys->Merge(std::move(*script_keys));
|
||||
} else {
|
||||
// Maybe there are pubkeys listed that we can sign for
|
||||
script_keys = std::make_unique<FlatSigningProvider>();
|
||||
@ -2186,7 +2186,7 @@ TransactionError DescriptorScriptPubKeyMan::FillPSBT(PartiallySignedTransaction&
|
||||
const CPubKey& pubkey = pk_pair.first;
|
||||
std::unique_ptr<FlatSigningProvider> pk_keys = GetSigningProvider(pubkey);
|
||||
if (pk_keys) {
|
||||
*keys = Merge(*keys, *pk_keys);
|
||||
keys->Merge(std::move(*pk_keys));
|
||||
}
|
||||
}
|
||||
for (const auto& pk_pair : input.m_tap_bip32_paths) {
|
||||
@ -2198,7 +2198,7 @@ TransactionError DescriptorScriptPubKeyMan::FillPSBT(PartiallySignedTransaction&
|
||||
fullpubkey.Set(b, b + 33);
|
||||
std::unique_ptr<FlatSigningProvider> pk_keys = GetSigningProvider(fullpubkey);
|
||||
if (pk_keys) {
|
||||
*keys = Merge(*keys, *pk_keys);
|
||||
keys->Merge(std::move(*pk_keys));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user