mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-07 11:12:50 +01:00
Implement joinpsbts RPC and tests
Adds a joinpsbts RPC which combines multiple distinct PSBTs into one PSBT.
This commit is contained in:
20
src/psbt.cpp
20
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();
|
||||
|
||||
Reference in New Issue
Block a user