mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 23:07:59 +01:00
Add GetVersion helper to PSBT
This commit is contained in:
parent
c3eb416b88
commit
df84fa99c5
2 changed files with 10 additions and 1 deletions
|
@ -401,3 +401,11 @@ bool DecodeRawPSBT(PartiallySignedTransaction& psbt, const std::string& tx_data,
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t PartiallySignedTransaction::GetVersion() const
|
||||||
|
{
|
||||||
|
if (m_version != std::nullopt) {
|
||||||
|
return *m_version;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -405,6 +405,7 @@ struct PartiallySignedTransaction
|
||||||
std::optional<uint32_t> m_version;
|
std::optional<uint32_t> m_version;
|
||||||
|
|
||||||
bool IsNull() const;
|
bool IsNull() const;
|
||||||
|
uint32_t GetVersion() const;
|
||||||
|
|
||||||
/** Merge psbt into this. The two psbts must have the same underlying CTransaction (i.e. the
|
/** 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. */
|
* same actual Bitcoin transaction.) Returns true if the merge succeeded, false otherwise. */
|
||||||
|
@ -436,7 +437,7 @@ struct PartiallySignedTransaction
|
||||||
SerializeToVector(os, *tx);
|
SerializeToVector(os, *tx);
|
||||||
|
|
||||||
// PSBT version
|
// PSBT version
|
||||||
if (m_version != std::nullopt && *m_version > 0) {
|
if (GetVersion() > 0) {
|
||||||
SerializeToVector(s, CompactSizeWriter(PSBT_GLOBAL_VERSION));
|
SerializeToVector(s, CompactSizeWriter(PSBT_GLOBAL_VERSION));
|
||||||
SerializeToVector(s, *m_version);
|
SerializeToVector(s, *m_version);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue