mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-12 15:03:18 +02:00
psbt: add PSBTv2 global tx fields
When decomposing a transaction into a PSBTv2, the tx version and locktime need to be stored in their respective global fields. Add those fields and fill them when constructing.
This commit is contained in:
@@ -16,6 +16,8 @@ using common::PSBTError;
|
||||
|
||||
PartiallySignedTransaction::PartiallySignedTransaction(const CMutableTransaction& tx) : tx(tx)
|
||||
{
|
||||
tx_version = tx.version;
|
||||
fallback_locktime = tx.nLockTime;
|
||||
inputs.reserve(tx.vin.size());
|
||||
for (const CTxIn& input : tx.vin) {
|
||||
inputs.emplace_back(GetVersion(), input.prevout.hash, input.prevout.n, input.nSequence);
|
||||
|
||||
@@ -1073,6 +1073,9 @@ public:
|
||||
std::map<std::vector<unsigned char>, std::vector<unsigned char>> unknown;
|
||||
std::set<PSBTProprietary> m_proprietary;
|
||||
|
||||
uint32_t tx_version;
|
||||
std::optional<uint32_t> fallback_locktime;
|
||||
|
||||
bool IsNull() const;
|
||||
uint32_t GetVersion() const;
|
||||
|
||||
@@ -1203,6 +1206,8 @@ public:
|
||||
throw std::ios_base::failure("Unsigned tx does not have empty scriptSigs and scriptWitnesses.");
|
||||
}
|
||||
}
|
||||
tx_version = tx->version;
|
||||
fallback_locktime = tx->nLockTime;
|
||||
break;
|
||||
}
|
||||
case PSBT_GLOBAL_XPUB:
|
||||
|
||||
Reference in New Issue
Block a user