diff options
author | Andrew Chow <achow101-github@achow101.com> | 2018-07-20 18:24:16 -0700 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2019-02-16 00:04:27 -0500 |
commit | 08f749c9147a5f3fdbbd880e0974b97084429002 (patch) | |
tree | b54ee7d58a907acbe39af79fd2e8d226a2b520fe /src/psbt.cpp | |
parent | 7344a7b9984b99882e136efc8ad48fb31740df93 (diff) |
Implement joinpsbts RPC and tests
Adds a joinpsbts RPC which combines multiple distinct PSBTs into
one PSBT.
Diffstat (limited to 'src/psbt.cpp')
-rw-r--r-- | src/psbt.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/psbt.cpp b/src/psbt.cpp index 81633c0cc7..424b92cfb5 100644 --- a/src/psbt.cpp +++ b/src/psbt.cpp @@ -42,6 +42,26 @@ bool PartiallySignedTransaction::IsSane() const return true; } +bool PartiallySignedTransaction::AddInput(const CTxIn& txin, PSBTInput& psbtin) +{ + if (std::find(tx->vin.begin(), tx->vin.end(), txin) != tx->vin.end()) { + return false; + } + tx->vin.push_back(txin); + psbtin.partial_sigs.clear(); + psbtin.final_script_sig.clear(); + psbtin.final_script_witness.SetNull(); + inputs.push_back(psbtin); + return true; +} + +bool PartiallySignedTransaction::AddOutput(const CTxOut& txout, const PSBTOutput& psbtout) +{ + tx->vout.push_back(txout); + outputs.push_back(psbtout); + return true; +} + bool PSBTInput::IsNull() const { return !non_witness_utxo && witness_utxo.IsNull() && partial_sigs.empty() && unknown.empty() && hd_keypaths.empty() && redeem_script.empty() && witness_script.empty(); |