diff options
| author | Andrew Chow <[email protected]> | 2019-11-19 14:54:13 -0500 |
|---|---|---|
| committer | Andrew Chow <[email protected]> | 2019-11-19 14:54:13 -0500 |
| commit | 773d4572a4864ab7b6380858d07d9579ff6dd9a2 (patch) | |
| tree | 42a12df2265d2a9b3f1c92a51e96c0ab5641ac68 /src/node/psbt.cpp | |
| parent | Have a PSBTAnalysis state that indicates invalid PSBT (diff) | |
| download | discoin-773d4572a4864ab7b6380858d07d9579ff6dd9a2.tar.xz discoin-773d4572a4864ab7b6380858d07d9579ff6dd9a2.zip | |
Mark PSBTs spending unspendable outputs as invalid in analysis
Diffstat (limited to 'src/node/psbt.cpp')
| -rw-r--r-- | src/node/psbt.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/node/psbt.cpp b/src/node/psbt.cpp index 12559c5a5..9a30c3f08 100644 --- a/src/node/psbt.cpp +++ b/src/node/psbt.cpp @@ -7,6 +7,7 @@ #include <node/psbt.h> #include <policy/policy.h> #include <policy/settings.h> +#include <tinyformat.h> #include <numeric> @@ -39,6 +40,11 @@ PSBTAnalysis AnalyzePSBT(PartiallySignedTransaction psbtx) calc_fee = false; } + if (!utxo.IsNull() && utxo.scriptPubKey.IsUnspendable()) { + result.SetInvalid(strprintf("PSBT is not valid. Input %u spends unspendable output", i)); + return result; + } + // Check if it is final if (!utxo.IsNull() && !PSBTInputSigned(input)) { input_analysis.is_final = false; |