diff --git a/src/psbt.cpp b/src/psbt.cpp index 6585766807a..4c9b4398150 100644 --- a/src/psbt.cpp +++ b/src/psbt.cpp @@ -32,6 +32,13 @@ bool PartiallySignedTransaction::Merge(const PartiallySignedTransaction& psbt) for (unsigned int i = 0; i < outputs.size(); ++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()); return true; @@ -401,3 +408,11 @@ bool DecodeRawPSBT(PartiallySignedTransaction& psbt, const std::string& tx_data, } return true; } + +uint32_t PartiallySignedTransaction::GetVersion() const +{ + if (m_version != std::nullopt) { + return *m_version; + } + return 0; +} diff --git a/src/psbt.h b/src/psbt.h index 21daa050ea0..690d1b3bbd9 100644 --- a/src/psbt.h +++ b/src/psbt.h @@ -10,8 +10,11 @@ #include #include #include +#include