New PartiallySignedTransaction constructor from CTransction
New constructor that creates a PartiallySignedTransaction from a
CTransaction, automatically sizing the inputs and outputs vectors for
convenience.
Github-Pull: #14588
Rebased-From: 65166d4cf8
This commit is contained in:
parent
a9eab081d5
commit
70ee1f8709
3 changed files with 8 additions and 8 deletions
|
@ -491,6 +491,12 @@ bool IsSolvable(const SigningProvider& provider, const CScript& script)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PartiallySignedTransaction::PartiallySignedTransaction(const CTransaction& tx) : tx(tx)
|
||||||
|
{
|
||||||
|
inputs.resize(tx.vin.size());
|
||||||
|
outputs.resize(tx.vout.size());
|
||||||
|
}
|
||||||
|
|
||||||
bool PartiallySignedTransaction::IsNull() const
|
bool PartiallySignedTransaction::IsNull() const
|
||||||
{
|
{
|
||||||
return !tx && inputs.empty() && outputs.empty() && unknown.empty();
|
return !tx && inputs.empty() && outputs.empty() && unknown.empty();
|
||||||
|
|
|
@ -550,6 +550,7 @@ struct PartiallySignedTransaction
|
||||||
bool IsSane() const;
|
bool IsSane() const;
|
||||||
PartiallySignedTransaction() {}
|
PartiallySignedTransaction() {}
|
||||||
PartiallySignedTransaction(const PartiallySignedTransaction& psbt_in) : tx(psbt_in.tx), inputs(psbt_in.inputs), outputs(psbt_in.outputs), unknown(psbt_in.unknown) {}
|
PartiallySignedTransaction(const PartiallySignedTransaction& psbt_in) : tx(psbt_in.tx), inputs(psbt_in.inputs), outputs(psbt_in.outputs), unknown(psbt_in.unknown) {}
|
||||||
|
explicit PartiallySignedTransaction(const CTransaction& tx);
|
||||||
|
|
||||||
// Only checks if they refer to the same transaction
|
// Only checks if they refer to the same transaction
|
||||||
friend bool operator==(const PartiallySignedTransaction& a, const PartiallySignedTransaction &b)
|
friend bool operator==(const PartiallySignedTransaction& a, const PartiallySignedTransaction &b)
|
||||||
|
|
|
@ -4737,14 +4737,7 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
|
||||||
FundTransaction(pwallet, rawTx, fee, change_position, request.params[3]);
|
FundTransaction(pwallet, rawTx, fee, change_position, request.params[3]);
|
||||||
|
|
||||||
// Make a blank psbt
|
// Make a blank psbt
|
||||||
PartiallySignedTransaction psbtx;
|
PartiallySignedTransaction psbtx(rawTx);
|
||||||
psbtx.tx = rawTx;
|
|
||||||
for (unsigned int i = 0; i < rawTx.vin.size(); ++i) {
|
|
||||||
psbtx.inputs.push_back(PSBTInput());
|
|
||||||
}
|
|
||||||
for (unsigned int i = 0; i < rawTx.vout.size(); ++i) {
|
|
||||||
psbtx.outputs.push_back(PSBTOutput());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill transaction with out data but don't sign
|
// Fill transaction with out data but don't sign
|
||||||
bool bip32derivs = request.params[4].isNull() ? false : request.params[4].get_bool();
|
bool bip32derivs = request.params[4].isNull() ? false : request.params[4].get_bool();
|
||||||
|
|
Loading…
Reference in a new issue