@@ -160,7 +160,7 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnes
160160 return true ;
161161}
162162
163- bool AreInputsStandard (const CTransaction& tx, const CCoinsViewCache& mapInputs)
163+ bool AreInputsStandard (const CTransaction& tx, const CCoinsViewCache& mapInputs, const std::string& reason_prefix, std::string& out_reason )
164164{
165165 if (tx.IsCoinBase ())
166166 return true ; // Coinbases don't use vin normally
@@ -173,19 +173,26 @@ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs)
173173 txnouttype whichType;
174174 // get the scriptPubKey corresponding to this input:
175175 const CScript& prevScript = prev.scriptPubKey ;
176- if (!Solver (prevScript, whichType, vSolutions))
176+ if (!Solver (prevScript, whichType, vSolutions)) {
177+ out_reason = reason_prefix + " script-unknown" ;
177178 return false ;
179+ }
178180
179181 if (whichType == TX_SCRIPTHASH)
180182 {
181183 std::vector<std::vector<unsigned char > > stack;
182184 // convert the scriptSig into a stack, so we can inspect the redeemScript
183- if (!EvalScript (stack, tx.vin [i].scriptSig , SCRIPT_VERIFY_NONE, BaseSignatureChecker (), SIGVERSION_BASE))
185+ if (!EvalScript (stack, tx.vin [i].scriptSig , SCRIPT_VERIFY_NONE, BaseSignatureChecker (), SIGVERSION_BASE)) {
186+ out_reason = reason_prefix + " scriptsig-failure" ;
184187 return false ;
185- if (stack.empty ())
188+ }
189+ if (stack.empty ()) {
190+ out_reason = reason_prefix + " scriptcheck-missing" ;
186191 return false ;
192+ }
187193 CScript subscript (stack.back ().begin (), stack.back ().end ());
188194 if (subscript.GetSigOpCount (true ) > MAX_P2SH_SIGOPS) {
195+ out_reason = reason_prefix + " scriptcheck-sigops" ;
189196 return false ;
190197 }
191198 }
0 commit comments