16#include <boost/test/unit_test.hpp>
47 std::vector<CMutableTransaction>
spends;
49 for (
int i = 0; i < 2; i++)
53 spends[i].vin[0].prevout.hash = m_coinbase_txns[0]->GetHash();
54 spends[i].vin[0].prevout.n = 0;
57 spends[i].vout[0].scriptPubKey = scriptPubKey;
60 std::vector<unsigned char>
vchSig;
70 block = CreateAndProcessBlock(
spends, scriptPubKey);
78 block = CreateAndProcessBlock(
spends, scriptPubKey);
89 block = CreateAndProcessBlock(
spends, scriptPubKey);
99 std::vector<CMutableTransaction>
oneSpend;
102 block = CreateAndProcessBlock(
oneSpend, scriptPubKey);
188 spend_tx.vin[0].prevout.hash = m_coinbase_txns[0]->GetHash();
202 std::vector<unsigned char>
vchSig;
205 vchSig.push_back((
unsigned char) 0);
275 std::vector<unsigned char>
vchSig;
303 std::vector<unsigned char>
vchSig;
352 tx.
vin[0].prevout.n = 0;
354 tx.
vin[1].prevout.n = 1;
360 for (
int i = 0; i < 2; ++i) {
372 tx.
vin[1].scriptWitness.SetNull();
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
Fillable signing provider that keeps keys in an address->secret map.
A signature creator for transactions.
Convenience class for initializing and passing the script execution cache and signature cache.
static constexpr script_verify_flags from_int(value_type f)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
BOOST_AUTO_TEST_SUITE_END()
uint256 SignatureHash(const CScript &scriptCode, const T &txTo, unsigned int nIn, int32_t nHashType, const CAmount &amount, SigVersion sigversion, const PrecomputedTransactionData *cache, SigHashCache *sighash_cache)
static constexpr script_verify_flags::value_type MAX_SCRIPT_VERIFY_FLAGS
@ BASE
Bare scripts and BIP16 P2SH-wrapped redeemscripts.
@ SCRIPT_VERIFY_STRICTENC
@ SCRIPT_VERIFY_CHECKSEQUENCEVERIFY
@ SCRIPT_VERIFY_CLEANSTACK
@ SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY
@ CONFLICT
Removed for conflict with in-block transaction.
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::vector< unsigned char > ToByteVector(const T &in)
static constexpr CAmount CENT
bool ProduceSignature(const SigningProvider &provider, const BaseSignatureCreator &creator, const CScript &fromPubKey, SignatureData &sigdata)
Produce a script signature using a generic signature creator.
void UpdateInput(CTxIn &input, const SignatureData &data)
A mutable version of CTransaction.
std::vector< CTxOut > vout
Validation result for a transaction evaluated by MemPoolAccept (single or package).
const ResultType m_result_type
Result type.
Testing fixture that pre-creates a 100-block REGTEST-mode block chain.
std::unique_ptr< CTxMemPool > mempool
std::unique_ptr< ChainstateManager > chainman
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
#define EXCLUSIVE_LOCKS_REQUIRED(...)
static void ValidateCheckInputsForAllFlags(const CTransaction &tx, script_verify_flags failing_flags, bool add_to_cache, CCoinsViewCache &active_coins_tip, ValidationCache &validation_cache) EXCLUSIVE_LOCKS_REQUIRED(
BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, Dersig100Setup)
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.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.