Changeset View
Changeset View
Standalone View
Standalone View
src/test/txvalidationcache_tests.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | for (int i = 0; i < 2; i++) { | ||||
spends[i].vin.resize(1); | spends[i].vin.resize(1); | ||||
spends[i].vin[0].prevout.hash = coinbaseTxns[0].GetId(); | spends[i].vin[0].prevout.hash = coinbaseTxns[0].GetId(); | ||||
spends[i].vin[0].prevout.n = 0; | spends[i].vin[0].prevout.n = 0; | ||||
spends[i].vout.resize(1); | spends[i].vout.resize(1); | ||||
spends[i].vout[0].nValue = 11 * CENT; | spends[i].vout[0].nValue = 11 * CENT; | ||||
spends[i].vout[0].scriptPubKey = scriptPubKey; | spends[i].vout[0].scriptPubKey = scriptPubKey; | ||||
// Sign: | // Sign: | ||||
std::vector<unsigned char> vchSig; | std::vector<uint8_t> vchSig; | ||||
uint256 hash = | uint256 hash = | ||||
SignatureHash(scriptPubKey, spends[i], 0, SIGHASH_ALL, 0); | SignatureHash(scriptPubKey, spends[i], 0, SIGHASH_ALL, 0); | ||||
BOOST_CHECK(coinbaseKey.Sign(hash, vchSig)); | BOOST_CHECK(coinbaseKey.Sign(hash, vchSig)); | ||||
vchSig.push_back((unsigned char)SIGHASH_ALL); | vchSig.push_back(uint8_t(SIGHASH_ALL)); | ||||
spends[i].vin[0].scriptSig << vchSig; | spends[i].vin[0].scriptSig << vchSig; | ||||
} | } | ||||
CBlock block; | CBlock block; | ||||
// Test 1: block with both of those transactions should be rejected. | // Test 1: block with both of those transactions should be rejected. | ||||
block = CreateAndProcessBlock(spends, scriptPubKey); | block = CreateAndProcessBlock(spends, scriptPubKey); | ||||
BOOST_CHECK(chainActive.Tip()->GetBlockHash() != block.GetHash()); | BOOST_CHECK(chainActive.Tip()->GetBlockHash() != block.GetHash()); | ||||
Show All 25 Lines |