diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -29,7 +29,9 @@ */ bool IsStandard(const CScript &scriptPubKey, txnouttype &whichType) { std::vector> vSolutions; - if (!Solver(scriptPubKey, whichType, vSolutions)) return false; + if (!Solver(scriptPubKey, whichType, vSolutions)) { + return false; + } if (whichType == TX_MULTISIG) { uint8_t m = vSolutions.front()[0]; @@ -93,9 +95,9 @@ return false; } - if (whichType == TX_NULL_DATA) + if (whichType == TX_NULL_DATA) { nDataOut++; - else if ((whichType == TX_MULTISIG) && (!fIsBareMultisigStd)) { + } else if ((whichType == TX_MULTISIG) && (!fIsBareMultisigStd)) { reason = "bare-multisig"; return false; } else if (txout.IsDust(dustRelayFee)) { @@ -120,23 +122,29 @@ return true; } - for (unsigned int i = 0; i < tx.vin.size(); i++) { + for (size_t i = 0; i < tx.vin.size(); i++) { const CTxOut &prev = mapInputs.GetOutputFor(tx.vin[i]); std::vector> vSolutions; txnouttype whichType; // get the scriptPubKey corresponding to this input: const CScript &prevScript = prev.scriptPubKey; - if (!Solver(prevScript, whichType, vSolutions)) return false; + if (!Solver(prevScript, whichType, vSolutions)) { + return false; + } if (whichType == TX_SCRIPTHASH) { std::vector> stack; // convert the scriptSig into a stack, so we can inspect the // redeemScript if (!EvalScript(stack, tx.vin[i].scriptSig, SCRIPT_VERIFY_NONE, - BaseSignatureChecker())) + BaseSignatureChecker())) { return false; - if (stack.empty()) return false; + } + if (stack.empty()) { + return false; + } + CScript subscript(stack.back().begin(), stack.back().end()); if (subscript.GetSigOpCount(true) > MAX_P2SH_SIGOPS) { return false;