47 std::vector<CMutableTransaction> spends;
49 for (
int i = 0; i < 2; i++)
51 spends[i].version = 1;
52 spends[i].vin.resize(1);
53 spends[i].vin[0].prevout.hash = m_coinbase_txns[0]->GetHash();
54 spends[i].vin[0].prevout.n = 0;
55 spends[i].vout.resize(1);
56 spends[i].vout[0].nValue = 11*
CENT;
57 spends[i].vout[0].scriptPubKey = scriptPubKey;
60 std::vector<unsigned char> vchSig;
64 spends[i].vin[0].scriptSig << vchSig;
70 block = CreateAndProcessBlock(spends, scriptPubKey);
78 block = CreateAndProcessBlock(spends, scriptPubKey);
89 block = CreateAndProcessBlock(spends, scriptPubKey);
99 std::vector<CMutableTransaction> oneSpend;
100 oneSpend.push_back(spends[0]);
102 block = CreateAndProcessBlock(oneSpend, scriptPubKey);
145 bool ret =
CheckInputScripts(tx, state, &active_coins_tip, test_flags,
true, add_to_cache, txdata, validation_cache,
nullptr);
148 bool expected_return_value = !(test_flags & failing_flags);
152 if (
ret && add_to_cache) {
154 std::vector<CScriptCheck> scriptchecks;
160 std::vector<CScriptCheck> scriptchecks;
187 spend_tx.
vin.resize(1);
188 spend_tx.
vin[0].prevout.hash = m_coinbase_txns[0]->GetHash();
189 spend_tx.
vin[0].prevout.n = 0;
190 spend_tx.
vout.resize(4);
192 spend_tx.
vout[0].scriptPubKey = p2sh_scriptPubKey;
194 spend_tx.
vout[1].scriptPubKey = p2wpkh_scriptPubKey;
202 std::vector<unsigned char> vchSig;
205 vchSig.push_back((
unsigned char) 0);
207 spend_tx.
vin[0].scriptSig << vchSig;
224 std::vector<CScriptCheck> scriptchecks;
239 block = CreateAndProcessBlock({spend_tx}, p2pk_scriptPubKey);
242 BOOST_CHECK(m_node.chainman->ActiveChainstate().CoinsTip().GetBestBlock() == block.
GetHash());
248 invalid_under_p2sh_tx.
version = 1;
249 invalid_under_p2sh_tx.
vin.resize(1);
250 invalid_under_p2sh_tx.
vin[0].prevout.hash = spend_tx.
GetHash();
251 invalid_under_p2sh_tx.
vin[0].prevout.n = 0;
252 invalid_under_p2sh_tx.
vout.resize(1);
253 invalid_under_p2sh_tx.
vout[0].nValue = 11*
CENT;
254 invalid_under_p2sh_tx.
vout[0].scriptPubKey = p2pk_scriptPubKey;
255 std::vector<unsigned char> vchSig2(p2pk_scriptPubKey.
begin(), p2pk_scriptPubKey.
end());
256 invalid_under_p2sh_tx.
vin[0].scriptSig << vchSig2;
264 invalid_with_cltv_tx.
version = 1;
266 invalid_with_cltv_tx.
vin.resize(1);
267 invalid_with_cltv_tx.
vin[0].prevout.hash = spend_tx.
GetHash();
268 invalid_with_cltv_tx.
vin[0].prevout.n = 2;
269 invalid_with_cltv_tx.
vin[0].nSequence = 0;
270 invalid_with_cltv_tx.
vout.resize(1);
271 invalid_with_cltv_tx.
vout[0].nValue = 11*
CENT;
272 invalid_with_cltv_tx.
vout[0].scriptPubKey = p2pk_scriptPubKey;
275 std::vector<unsigned char> vchSig;
279 invalid_with_cltv_tx.
vin[0].scriptSig =
CScript() << vchSig << 101;
284 invalid_with_cltv_tx.
vin[0].scriptSig =
CScript() << vchSig << 100;
293 invalid_with_csv_tx.
version = 2;
294 invalid_with_csv_tx.
vin.resize(1);
295 invalid_with_csv_tx.
vin[0].prevout.hash = spend_tx.
GetHash();
296 invalid_with_csv_tx.
vin[0].prevout.n = 3;
297 invalid_with_csv_tx.
vin[0].nSequence = 100;
298 invalid_with_csv_tx.
vout.resize(1);
299 invalid_with_csv_tx.
vout[0].nValue = 11*
CENT;
300 invalid_with_csv_tx.
vout[0].scriptPubKey = p2pk_scriptPubKey;
303 std::vector<unsigned char> vchSig;
307 invalid_with_csv_tx.
vin[0].scriptSig =
CScript() << vchSig << 101;
312 invalid_with_csv_tx.
vin[0].scriptSig =
CScript() << vchSig << 100;
324 valid_with_witness_tx.
version = 1;
325 valid_with_witness_tx.
vin.resize(1);
326 valid_with_witness_tx.
vin[0].prevout.hash = spend_tx.
GetHash();
327 valid_with_witness_tx.
vin[0].prevout.n = 1;
328 valid_with_witness_tx.
vout.resize(1);
329 valid_with_witness_tx.
vout[0].nValue = 11*
CENT;
330 valid_with_witness_tx.
vout[0].scriptPubKey = p2pk_scriptPubKey;
341 valid_with_witness_tx.
vin[0].scriptWitness.SetNull();
352 tx.
vin[0].prevout.n = 0;
354 tx.
vin[1].prevout.n = 1;
357 tx.
vout[0].scriptPubKey = p2pk_scriptPubKey;
360 for (
int i = 0; i < 2; ++i) {
372 tx.
vin[1].scriptWitness.SetNull();
379 std::vector<CScriptCheck> scriptchecks;
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
bool CheckInputScripts(const CTransaction &tx, TxValidationState &state, const CCoinsViewCache &inputs, script_verify_flags flags, bool cacheSigStore, bool cacheFullScriptStore, PrecomputedTransactionData &txdata, ValidationCache &validation_cache, std::vector< CScriptCheck > *pvChecks) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Check whether all of this transaction's input scripts succeed.