From 217a5c92380173ac43d303b1ba9548544121eefd Mon Sep 17 00:00:00 2001 From: Mark Friedenbach Date: Mon, 5 Aug 2013 18:27:09 -0700 Subject: [PATCH 1/2] When transaction outputs exceed inputs, show the offending amounts so as to aid debugging. --- src/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 9a4271eda..c1fabdd55 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,6 +17,7 @@ #include "txmempool.h" #include "ui_interface.h" #include "util.h" +#include "utilmoneystr.h" #include @@ -1361,7 +1362,8 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi } if (nValueIn < tx.GetValueOut()) - return state.DoS(100, error("CheckInputs() : %s value in < value out", tx.GetHash().ToString()), + return state.DoS(100, error("CheckInputs() : %s value in (%s) < value out (%s)", + tx.GetHash().ToString(), FormatMoney(nValueIn), FormatMoney(tx.GetValueOut())), REJECT_INVALID, "bad-txns-in-belowout"); // Tally transaction fees From f74fc9b22d7f39e36d0cbf80f5c06958c516c8ec Mon Sep 17 00:00:00 2001 From: Mark Friedenbach Date: Fri, 21 Mar 2014 12:27:44 -0700 Subject: [PATCH 2/2] Print input index when signature validation fails, to aid debugging. --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index c1fabdd55..7bb61f251 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1317,7 +1317,7 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach bool CScriptCheck::operator()() const { const CScript &scriptSig = ptxTo->vin[nIn].scriptSig; if (!VerifyScript(scriptSig, scriptPubKey, *ptxTo, nIn, nFlags)) - return error("CScriptCheck() : %s VerifySignature failed", ptxTo->GetHash().ToString()); + return error("CScriptCheck() : %s:%d VerifySignature failed", ptxTo->GetHash().ToString(), nIn); return true; }