Implement joinpsbts RPC and tests

Adds a joinpsbts RPC which combines multiple distinct PSBTs into
one PSBT.
This commit is contained in:
Andrew Chow
2018-07-20 18:24:16 -07:00
parent 7344a7b998
commit 08f749c914
5 changed files with 115 additions and 0 deletions

View File

@@ -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();