diff options
author | Andrew Chow <achow101-github@achow101.com> | 2019-11-19 14:54:13 -0500 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2020-01-03 04:04:38 +0000 |
commit | ca5f8deefd778195cb10a3419d3b5c0693abb958 (patch) | |
tree | f0bbe24a5aa46fc5684451b5f2d6f1436d0fb377 /src/node | |
parent | 551583398ba4fdae973c047bc60556ffa17c6431 (diff) |
Mark PSBTs spending unspendable outputs as invalid in analysis
Github-Pull: #17524
Rebased-From: 773d4572a4864ab7b6380858d07d9579ff6dd9a2
Diffstat (limited to 'src/node')
-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 12559c5a5f..9a30c3f083 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; |