16#include <boost/test/unit_test.hpp>
47 std::vector<CMutableTransaction>
spends;
49 for (
int i = 0; i < 2; i++)
52 spends[i].vin = {
CTxIn{m_coinbase_txns[0]->GetHash(), 0}};
56 std::vector<unsigned char>
vchSig;
66 block = CreateAndProcessBlock(
spends, scriptPubKey);
74 block = CreateAndProcessBlock(
spends, scriptPubKey);
85 block = CreateAndProcessBlock(
spends, scriptPubKey);
95 std::vector<CMutableTransaction>
oneSpend;
98 block = CreateAndProcessBlock(
oneSpend, scriptPubKey);
197 std::vector<unsigned char>
vchSig;
200 vchSig.push_back((
unsigned char) 0);
261 std::vector<unsigned char>
vchSig;
284 std::vector<unsigned char>
vchSig;
330 tr_keystore.
keys.emplace(coinbaseKey.GetPubKey().GetID(), coinbaseKey);
331 const std::map<COutPoint, Coin> coins{
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.
An input of a transaction.
An output of a transaction.
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)
constexpr script_verify_flags::value_type MAX_SCRIPT_VERIFY_FLAGS
@ BASE
Bare scripts and BIP16 P2SH-wrapped redeemscripts.
@ SIGHASH_DEFAULT
Taproot only; implied when sighash byte is missing, and equivalent to SIGHASH_ALL.
@ 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)
void SignTransaction(CMutableTransaction &mtx, const SigningProvider *keystore, const std::map< COutPoint, Coin > &coins, const UniValue &hashType, UniValue &result)
Sign a transaction with the given keystore and previous transactions.
std::vector< unsigned char > ToByteVector(const T &in)
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
std::map< CKeyID, CKey > keys
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.