| 1160 | } |
| 1161 | |
| 1162 | bool MemPoolAccept::ConsensusScriptChecks(const ATMPArgs& args, Workspace& ws) |
| 1163 | { |
| 1164 | AssertLockHeld(cs_main); |
| 1165 | AssertLockHeld(m_pool.cs); |
| 1166 | const CTransaction& tx = *ws.m_ptx; |
| 1167 | const Txid& hash = ws.m_hash; |
| 1168 | TxValidationState& state = ws.m_state; |
| 1169 | |
| 1170 | // Check again against the current block tip's script verification |
| 1171 | // flags to cache our script execution flags. This is, of course, |
| 1172 | // useless if the next block has different script flags from the |
| 1173 | // previous one, but because the cache tracks script flags for us it |
| 1174 | // will auto-invalidate and we'll just have a few blocks of extra |
| 1175 | // misses on soft-fork activation. |
| 1176 | // |
| 1177 | // This is also useful in case of bugs in the standard flags that cause |
| 1178 | // transactions to pass as valid when they're actually invalid. For |
| 1179 | // instance the STRICTENC flag was incorrectly allowing certain |
| 1180 | // CHECKSIG NOT scripts to pass, even though they were invalid. |
| 1181 | // |
| 1182 | // There is a similar check in CreateNewBlock() to prevent creating |
| 1183 | // invalid blocks (using TestBlockValidity), however allowing such |
| 1184 | // transactions into the mempool can be exploited as a DoS attack. |
| 1185 | script_verify_flags currentBlockScriptVerifyFlags{GetBlockScriptFlags(*m_active_chainstate.m_chain.Tip(), m_active_chainstate.m_chainman)}; |
| 1186 | if (!CheckInputsFromMempoolAndCache(tx, state, m_view, m_pool, currentBlockScriptVerifyFlags, |
| 1187 | ws.m_precomputed_txdata, m_active_chainstate.CoinsTip(), GetValidationCache())) { |
| 1188 | LogError("BUG! PLEASE REPORT THIS! CheckInputScripts failed against latest-block but not STANDARD flags %s, %s", hash.ToString(), state.ToString()); |
| 1189 | return Assume(false); |
| 1190 | } |
| 1191 | |
| 1192 | return true; |
| 1193 | } |
| 1194 | |
| 1195 | void MemPoolAccept::FinalizeSubpackage(const ATMPArgs& args) |
| 1196 | { |
nothing calls this directly
no test coverage detected