Changeset View
Changeset View
Standalone View
Standalone View
src/test/miner_tests.cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include "miner.h" | |||||
#include "chainparams.h" | #include "chainparams.h" | ||||
#include "coins.h" | #include "coins.h" | ||||
#include "config.h" | #include "config.h" | ||||
#include "consensus/consensus.h" | #include "consensus/consensus.h" | ||||
#include "consensus/merkle.h" | #include "consensus/merkle.h" | ||||
#include "consensus/validation.h" | #include "consensus/validation.h" | ||||
#include "miner.h" | |||||
#include "policy/policy.h" | #include "policy/policy.h" | ||||
#include "pubkey.h" | #include "pubkey.h" | ||||
#include "script/standard.h" | #include "script/standard.h" | ||||
#include "txmempool.h" | #include "txmempool.h" | ||||
#include "uint256.h" | #include "uint256.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include "utilstrencodings.h" | #include "utilstrencodings.h" | ||||
#include "validation.h" | #include "validation.h" | ||||
#include "validation.h" | |||||
#include "test/test_bitcoin.h" | #include "test/test_bitcoin.h" | ||||
#include <memory> | #include <memory> | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
BOOST_FIXTURE_TEST_SUITE(miner_tests, TestingSetup) | BOOST_FIXTURE_TEST_SUITE(miner_tests, TestingSetup) | ||||
▲ Show 20 Lines • Show All 266 Lines • ▼ Show 20 Lines | for (unsigned int i = 0; i < sizeof(blockinfo) / sizeof(*blockinfo); ++i) { | ||||
pblock->hashPrevBlock = pblock->GetHash(); | pblock->hashPrevBlock = pblock->GetHash(); | ||||
} | } | ||||
// Just to make sure we can still make simple blocks. | // Just to make sure we can still make simple blocks. | ||||
BOOST_CHECK( | BOOST_CHECK( | ||||
pblocktemplate = | pblocktemplate = | ||||
BlockAssembler(config, chainparams).CreateNewBlock(scriptPubKey)); | BlockAssembler(config, chainparams).CreateNewBlock(scriptPubKey)); | ||||
const CAmount BLOCKSUBSIDY = 50 * COIN; | const CAmount BLOCKSUBSIDY = 50 * COIN.GetSatoshis(); | ||||
const CAmount LOWFEE = CENT; | const CAmount LOWFEE = CENT.GetSatoshis(); | ||||
const CAmount HIGHFEE = COIN; | const CAmount HIGHFEE = COIN.GetSatoshis(); | ||||
const CAmount HIGHERFEE = 4 * COIN; | const CAmount HIGHERFEE = 4 * COIN.GetSatoshis(); | ||||
// block sigops > limit: 1000 CHECKMULTISIG + 1 | // block sigops > limit: 1000 CHECKMULTISIG + 1 | ||||
tx.vin.resize(1); | tx.vin.resize(1); | ||||
// NOTE: OP_NOP is used to force 20 SigOps for the CHECKMULTISIG | // NOTE: OP_NOP is used to force 20 SigOps for the CHECKMULTISIG | ||||
tx.vin[0].scriptSig = CScript() << OP_0 << OP_0 << OP_0 << OP_NOP | tx.vin[0].scriptSig = CScript() << OP_0 << OP_0 << OP_0 << OP_NOP | ||||
<< OP_CHECKMULTISIG << OP_1; | << OP_CHECKMULTISIG << OP_1; | ||||
tx.vin[0].prevout.hash = txFirst[0]->GetId(); | tx.vin[0].prevout.hash = txFirst[0]->GetId(); | ||||
tx.vin[0].prevout.n = 0; | tx.vin[0].prevout.n = 0; | ||||
▲ Show 20 Lines • Show All 468 Lines • Show Last 20 Lines |