mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
Add GetVersion helper to PSBT
This commit is contained in:
parent
50c281fc12
commit
ad2b2d7c58
2 changed files with 10 additions and 1 deletions
|
|
@ -383,3 +383,11 @@ bool DecodeRawPSBT(PartiallySignedTransaction& psbt, const std::string& tx_data,
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t PartiallySignedTransaction::GetVersion() const
|
||||
{
|
||||
if (m_version != nullopt) {
|
||||
return *m_version;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -402,6 +402,7 @@ struct PartiallySignedTransaction
|
|||
Optional<uint32_t> m_version;
|
||||
|
||||
bool IsNull() const;
|
||||
uint32_t GetVersion() const;
|
||||
|
||||
/** Merge psbt into this. The two psbts must have the same underlying CTransaction (i.e. the
|
||||
* same actual Bitcoin transaction.) Returns true if the merge succeeded, false otherwise. */
|
||||
|
|
@ -433,7 +434,7 @@ struct PartiallySignedTransaction
|
|||
SerializeToVector(os, *tx);
|
||||
|
||||
// PSBT version
|
||||
if (m_version != nullopt && *m_version > 0) {
|
||||
if (GetVersion() > 0) {
|
||||
SerializeToVector(s, CompactSizeWriter(PSBT_GLOBAL_VERSION));
|
||||
SerializeToVector(s, *m_version);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue