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]; @@ -39,8 +41,9 @@ if (m < 1 || m > n) return false; } else if (whichType == TX_NULL_DATA && (!fAcceptDatacarrier || - scriptPubKey.size() > nMaxDatacarrierBytes)) + scriptPubKey.size() > nMaxDatacarrierBytes)) { return false; + } return whichType != TX_NONSTANDARD; } @@ -86,9 +89,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)) { @@ -113,23 +116,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;