mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-18 04:41:21 +02:00
Merge global xpubs in joinpsbts and combinepsbts
This commit is contained in:
parent
d8043ddf64
commit
81521173ba
@ -32,6 +32,13 @@ bool PartiallySignedTransaction::Merge(const PartiallySignedTransaction& psbt)
|
|||||||
for (unsigned int i = 0; i < outputs.size(); ++i) {
|
for (unsigned int i = 0; i < outputs.size(); ++i) {
|
||||||
outputs[i].Merge(psbt.outputs[i]);
|
outputs[i].Merge(psbt.outputs[i]);
|
||||||
}
|
}
|
||||||
|
for (auto& xpub_pair : psbt.m_xpubs) {
|
||||||
|
if (m_xpubs.count(xpub_pair.first) == 0) {
|
||||||
|
m_xpubs[xpub_pair.first] = xpub_pair.second;
|
||||||
|
} else {
|
||||||
|
m_xpubs[xpub_pair.first].insert(xpub_pair.second.begin(), xpub_pair.second.end());
|
||||||
|
}
|
||||||
|
}
|
||||||
unknown.insert(psbt.unknown.begin(), psbt.unknown.end());
|
unknown.insert(psbt.unknown.begin(), psbt.unknown.end());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1858,6 +1858,13 @@ static RPCHelpMan joinpsbts()
|
|||||||
for (unsigned int i = 0; i < psbt.tx->vout.size(); ++i) {
|
for (unsigned int i = 0; i < psbt.tx->vout.size(); ++i) {
|
||||||
merged_psbt.AddOutput(psbt.tx->vout[i], psbt.outputs[i]);
|
merged_psbt.AddOutput(psbt.tx->vout[i], psbt.outputs[i]);
|
||||||
}
|
}
|
||||||
|
for (auto& xpub_pair : psbt.m_xpubs) {
|
||||||
|
if (merged_psbt.m_xpubs.count(xpub_pair.first) == 0) {
|
||||||
|
merged_psbt.m_xpubs[xpub_pair.first] = xpub_pair.second;
|
||||||
|
} else {
|
||||||
|
merged_psbt.m_xpubs[xpub_pair.first].insert(xpub_pair.second.begin(), xpub_pair.second.end());
|
||||||
|
}
|
||||||
|
}
|
||||||
merged_psbt.unknown.insert(psbt.unknown.begin(), psbt.unknown.end());
|
merged_psbt.unknown.insert(psbt.unknown.begin(), psbt.unknown.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user