psbt: preserve proprietary fields when combining PSBTs

CombinePSBTs currently preserves unknown records but drops proprietary records at the global, input, and output levels because the Merge() paths never union m_proprietary.

Preserve proprietary records in PartiallySignedTransaction::Merge(), PSBTInput::Merge(), and PSBTOutput::Merge() so combine/merge keeps all PSBT key-value data.
This commit is contained in:
w0xlt
2026-03-21 23:15:29 -07:00
parent ed1795aa17
commit 3f5b3c7a80

View File

@@ -79,6 +79,7 @@ bool PartiallySignedTransaction::Merge(const PartiallySignedTransaction& psbt)
m_tx_modifiable = final_modifiable;
}
m_proprietary.insert(psbt.m_proprietary.begin(), psbt.m_proprietary.end());
unknown.insert(psbt.unknown.begin(), psbt.unknown.end());
return true;
@@ -436,6 +437,7 @@ bool PSBTInput::Merge(const PSBTInput& input)
hash160_preimages.insert(input.hash160_preimages.begin(), input.hash160_preimages.end());
hash256_preimages.insert(input.hash256_preimages.begin(), input.hash256_preimages.end());
hd_keypaths.insert(input.hd_keypaths.begin(), input.hd_keypaths.end());
m_proprietary.insert(input.m_proprietary.begin(), input.m_proprietary.end());
unknown.insert(input.unknown.begin(), input.unknown.end());
m_tap_script_sigs.insert(input.m_tap_script_sigs.begin(), input.m_tap_script_sigs.end());
m_tap_scripts.insert(input.m_tap_scripts.begin(), input.m_tap_scripts.end());
@@ -534,6 +536,7 @@ bool PSBTOutput::IsNull() const
bool PSBTOutput::Merge(const PSBTOutput& output)
{
hd_keypaths.insert(output.hd_keypaths.begin(), output.hd_keypaths.end());
m_proprietary.insert(output.m_proprietary.begin(), output.m_proprietary.end());
unknown.insert(output.unknown.begin(), output.unknown.end());
m_tap_bip32_paths.insert(output.m_tap_bip32_paths.begin(), output.m_tap_bip32_paths.end());