aboutsummaryrefslogtreecommitdiff
path: root/src/psbt.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2018-07-31 17:56:47 -0700
committerAndrew Chow <achow101-github@achow101.com>2019-02-16 00:04:27 -0500
commit77542cf2a5f8abb97dd46f782c1b0199cc062033 (patch)
tree9afe02a12ae92cb9594d46f3d3e682f26c26551c /src/psbt.cpp
parentcb40b3abd4514361a024a1e7a1a281da9261261b (diff)
downloadbitcoin-77542cf2a5f8abb97dd46f782c1b0199cc062033.tar.xz
Move PSBT UTXO fetching to a separate method
Diffstat (limited to 'src/psbt.cpp')
-rw-r--r--src/psbt.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/psbt.cpp b/src/psbt.cpp
index 0734edcf8e..32fb459dec 100644
--- a/src/psbt.cpp
+++ b/src/psbt.cpp
@@ -62,6 +62,20 @@ bool PartiallySignedTransaction::AddOutput(const CTxOut& txout, const PSBTOutput
return true;
}
+bool PartiallySignedTransaction::GetInputUTXO(CTxOut& utxo, int input_index) const
+{
+ PSBTInput input = inputs[input_index];
+ int prevout_index = tx->vin[input_index].prevout.n;
+ if (input.non_witness_utxo) {
+ utxo = input.non_witness_utxo->vout[prevout_index];
+ } else if (!input.witness_utxo.IsNull()) {
+ utxo = input.witness_utxo;
+ } else {
+ return false;
+ }
+ 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();