Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13711212
D6045.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D6045.diff
View Options
diff --git a/src/psbt.h b/src/psbt.h
--- a/src/psbt.h
+++ b/src/psbt.h
@@ -330,6 +330,14 @@
: tx(psbt_in.tx), inputs(psbt_in.inputs), outputs(psbt_in.outputs),
unknown(psbt_in.unknown) {}
explicit PartiallySignedTransaction(const CTransaction &txIn);
+ /**
+ * Finds the UTXO for a given input index
+ *
+ * @param[out] utxo The UTXO of the input if found
+ * @param[in] input_index Index of the input to retrieve the UTXO of
+ * @return Whether the UTXO for the specified input was found
+ */
+ bool GetInputUTXO(CTxOut &utxo, int input_index) const;
PartiallySignedTransaction &
operator=(const PartiallySignedTransaction &other) = default;
diff --git a/src/psbt.cpp b/src/psbt.cpp
--- a/src/psbt.cpp
+++ b/src/psbt.cpp
@@ -60,6 +60,17 @@
return true;
}
+bool PartiallySignedTransaction::GetInputUTXO(CTxOut &utxo,
+ int input_index) const {
+ PSBTInput input = inputs[input_index];
+ if (!input.utxo.IsNull()) {
+ utxo = input.utxo;
+ } else {
+ return false;
+ }
+ return true;
+}
+
bool PSBTInput::IsNull() const {
return utxo.IsNull() && partial_sigs.empty() && unknown.empty() &&
hd_keypaths.empty() && redeem_script.empty();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 26, 10:58 (10 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5573342
Default Alt Text
D6045.diff (1 KB)
Attached To
D6045: [backport#13932] Move PSBT UTXO fetching to a separate method
Event Timeline
Log In to Comment