15 #include <boost/test/unit_test.hpp> 26 mtx.
vin.resize(num_inputs);
27 mtx.
vout.resize(num_outputs);
29 for (
size_t i{0}; i < num_inputs; ++i) {
31 mtx.
vin[i].prevout.n = 0;
32 mtx.
vin[i].scriptSig = random_script;
34 for (
size_t o{0}; o < num_outputs; ++o) {
36 mtx.
vout[o].scriptPubKey = random_script;
58 size_t total_weight{0};
60 package_too_large.push_back(large_ptx);
61 total_weight += size_large;
70 Package package_duplicate_txids_empty;
71 for (
auto i{0}; i < 3; ++i) {
90 auto mtx_parent = CreateValidMempoolTransaction(m_coinbase_txns[0], 0,
92 parent_locking_script,
99 auto mtx_child = CreateValidMempoolTransaction(tx_parent, 0,
101 child_locking_script,
105 BOOST_CHECK_MESSAGE(result_parent_child.m_state.IsValid(),
106 "Package validation unexpectedly failed: " << result_parent_child.m_state.GetRejectReason());
107 BOOST_CHECK(result_parent_child.m_tx_results.size() == 2);
108 auto it_parent = result_parent_child.m_tx_results.find(tx_parent->GetWitnessHash());
109 auto it_child = result_parent_child.m_tx_results.find(tx_child->GetWitnessHash());
110 BOOST_CHECK(it_parent != result_parent_child.m_tx_results.end());
111 BOOST_CHECK_MESSAGE(it_parent->second.m_state.IsValid(),
112 "Package validation unexpectedly failed: " << it_parent->second.m_state.GetRejectReason());
114 BOOST_CHECK_EQUAL(it_parent->second.m_wtxids_fee_calculations.value().size(), 1);
115 BOOST_CHECK_EQUAL(it_parent->second.m_wtxids_fee_calculations.value().front(), tx_parent->GetWitnessHash());
116 BOOST_CHECK(it_child != result_parent_child.m_tx_results.end());
117 BOOST_CHECK_MESSAGE(it_child->second.m_state.IsValid(),
118 "Package validation unexpectedly failed: " << it_child->second.m_state.GetRejectReason());
121 BOOST_CHECK_EQUAL(it_child->second.m_wtxids_fee_calculations.value().front(), tx_child->GetWitnessHash());
127 BOOST_CHECK(result_single_large.m_state.IsInvalid());
129 BOOST_CHECK_EQUAL(result_single_large.m_state.GetRejectReason(),
"transaction failed");
130 BOOST_CHECK(result_single_large.m_tx_results.size() == 1);
131 auto it_giant_tx = result_single_large.m_tx_results.find(giant_ptx->GetWitnessHash());
132 BOOST_CHECK(it_giant_tx != result_single_large.m_tx_results.end());
142 CKey placeholder_key;
145 CKey placeholder_key_2;
151 auto mtx_parent = CreateValidMempoolTransaction(m_coinbase_txns[0], 0, 0, coinbaseKey, spk,
155 auto mtx_child = CreateValidMempoolTransaction(tx_parent, 0, 101, placeholder_key, spk2,
172 for (
int i{0}; i < 24; ++i) {
173 auto parent =
MakeTransactionRef(CreateValidMempoolTransaction(m_coinbase_txns[i + 1],
174 0, 0, coinbaseKey, spk,
CAmount(48 *
COIN),
false));
175 package.emplace_back(parent);
176 child.
vin.emplace_back(
COutPoint(parent->GetHash(), 0));
178 child.
vout.emplace_back(47 *
COIN, spk2);
185 Shuffle(package.begin(), package.end(), rng);
193 package.erase(package.begin());
197 package.insert(package.begin(), m_coinbase_txns[0]);
204 mtx_parent.
vin.emplace_back(
COutPoint(m_coinbase_txns[0]->GetHash(), 0));
205 mtx_parent.
vout.emplace_back(20 *
COIN, spk);
206 mtx_parent.
vout.emplace_back(20 *
COIN, spk2);
210 mtx_parent_also_child.
vin.emplace_back(
COutPoint(tx_parent->GetHash(), 0));
211 mtx_parent_also_child.
vout.emplace_back(20 *
COIN, spk);
215 mtx_child.
vin.emplace_back(
COutPoint(tx_parent->GetHash(), 1));
216 mtx_child.
vin.emplace_back(
COutPoint(tx_parent_also_child->GetHash(), 0));
217 mtx_child.
vout.emplace_back(39 *
COIN, spk);
244 for (
size_t i{0}; i < 10; ++i) {
245 auto mtx = CreateValidMempoolTransaction(m_coinbase_txns[i + 25], 0,
247 parent_locking_script,
252 package_unrelated,
false);
253 BOOST_CHECK(result_unrelated_submit.m_state.IsInvalid());
255 BOOST_CHECK_EQUAL(result_unrelated_submit.m_state.GetRejectReason(),
"package-not-child-with-parents");
261 auto mtx_parent = CreateValidMempoolTransaction(m_coinbase_txns[0], 0,
263 parent_locking_script,
266 package_parent_child.push_back(tx_parent);
267 package_3gen.push_back(tx_parent);
272 auto mtx_child = CreateValidMempoolTransaction(tx_parent, 0,
274 child_locking_script,
277 package_parent_child.push_back(tx_child);
278 package_3gen.push_back(tx_child);
283 auto mtx_grandchild = CreateValidMempoolTransaction(tx_child, 0,
285 grandchild_locking_script,
288 package_3gen.push_back(tx_grandchild);
293 package_3gen,
false);
294 BOOST_CHECK(result_3gen_submit.m_state.IsInvalid());
296 BOOST_CHECK_EQUAL(result_3gen_submit.m_state.GetRejectReason(),
"package-not-child-with-parents");
304 bad_witness.
stack.emplace_back(1);
306 mtx_parent_invalid.
vin[0].scriptWitness = bad_witness;
309 {tx_parent_invalid, tx_child},
false);
310 BOOST_CHECK(result_quit_early.m_state.IsInvalid());
312 BOOST_CHECK(!result_quit_early.m_tx_results.empty());
314 auto it_parent = result_quit_early.m_tx_results.find(tx_parent_invalid->GetWitnessHash());
315 auto it_child = result_quit_early.m_tx_results.find(tx_child->GetWitnessHash());
316 BOOST_CHECK(it_parent != result_quit_early.m_tx_results.end());
317 BOOST_CHECK(it_child != result_quit_early.m_tx_results.end());
319 BOOST_CHECK_EQUAL(it_parent->second.m_state.GetRejectReason(),
"bad-witness-nonstandard");
321 BOOST_CHECK_EQUAL(it_child->second.m_state.GetRejectReason(),
"bad-txns-inputs-missingorspent");
325 mtx_child.vin.emplace_back(
COutPoint(package_unrelated[0]->GetHash(), 0));
326 Package package_missing_parent;
327 package_missing_parent.push_back(tx_parent);
331 package_missing_parent,
false);
332 BOOST_CHECK(result_missing_parent.m_state.IsInvalid());
334 BOOST_CHECK_EQUAL(result_missing_parent.m_state.GetRejectReason(),
"package-not-child-with-unconfirmed-parents");
341 package_parent_child,
false);
342 expected_pool_size += 2;
343 BOOST_CHECK_MESSAGE(submit_parent_child.m_state.IsValid(),
344 "Package validation unexpectedly failed: " << submit_parent_child.m_state.GetRejectReason());
345 BOOST_CHECK_EQUAL(submit_parent_child.m_tx_results.size(), package_parent_child.size());
346 auto it_parent = submit_parent_child.m_tx_results.find(tx_parent->GetWitnessHash());
347 auto it_child = submit_parent_child.m_tx_results.find(tx_child->GetWitnessHash());
348 BOOST_CHECK(it_parent != submit_parent_child.m_tx_results.end());
351 BOOST_CHECK_EQUAL(it_parent->second.m_wtxids_fee_calculations.value().size(), 1);
352 BOOST_CHECK_EQUAL(it_parent->second.m_wtxids_fee_calculations.value().front(), tx_parent->GetWitnessHash());
353 BOOST_CHECK(it_child != submit_parent_child.m_tx_results.end());
357 BOOST_CHECK_EQUAL(it_child->second.m_wtxids_fee_calculations.value().front(), tx_child->GetWitnessHash());
367 package_parent_child,
false);
368 BOOST_CHECK_MESSAGE(submit_deduped.m_state.IsValid(),
369 "Package validation unexpectedly failed: " << submit_deduped.m_state.GetRejectReason());
370 BOOST_CHECK_EQUAL(submit_deduped.m_tx_results.size(), package_parent_child.size());
371 auto it_parent_deduped = submit_deduped.m_tx_results.find(tx_parent->GetWitnessHash());
372 auto it_child_deduped = submit_deduped.m_tx_results.find(tx_child->GetWitnessHash());
373 BOOST_CHECK(it_parent_deduped != submit_deduped.m_tx_results.end());
374 BOOST_CHECK(it_parent_deduped->second.m_state.IsValid());
376 BOOST_CHECK(it_child_deduped != submit_deduped.m_tx_results.end());
377 BOOST_CHECK(it_child_deduped->second.m_state.IsValid());
399 auto mtx_parent = CreateValidMempoolTransaction(m_coinbase_txns[0], 0,
407 witness1.
stack.emplace_back(1);
408 witness1.
stack.emplace_back(witnessScript.
begin(), witnessScript.
end());
411 witness2.
stack.emplace_back(2);
412 witness2.
stack.emplace_back(witnessScript.
begin(), witnessScript.
end());
419 mtx_child1.
vin.resize(1);
420 mtx_child1.
vin[0].prevout.hash = ptx_parent->GetHash();
421 mtx_child1.
vin[0].prevout.n = 0;
423 mtx_child1.
vin[0].scriptWitness = witness1;
424 mtx_child1.
vout.resize(1);
426 mtx_child1.
vout[0].scriptPubKey = child_locking_script;
429 mtx_child2.
vin[0].scriptWitness = witness2;
437 BOOST_CHECK(ptx_child1->GetWitnessHash() != ptx_child2->GetWitnessHash());
443 {ptx_parent, ptx_child1},
false);
444 BOOST_CHECK_MESSAGE(submit_witness1.m_state.IsValid(),
445 "Package validation unexpectedly failed: " << submit_witness1.m_state.GetRejectReason());
447 auto it_parent1 = submit_witness1.m_tx_results.find(ptx_parent->GetWitnessHash());
448 auto it_child1 = submit_witness1.m_tx_results.find(ptx_child1->GetWitnessHash());
449 BOOST_CHECK(it_parent1 != submit_witness1.m_tx_results.end());
450 BOOST_CHECK_MESSAGE(it_parent1->second.m_state.IsValid(),
451 "Transaction unexpectedly failed: " << it_parent1->second.m_state.GetRejectReason());
452 BOOST_CHECK(it_child1 != submit_witness1.m_tx_results.end());
453 BOOST_CHECK_MESSAGE(it_child1->second.m_state.IsValid(),
454 "Transaction unexpectedly failed: " << it_child1->second.m_state.GetRejectReason());
461 {ptx_parent, ptx_child2},
false);
462 BOOST_CHECK_MESSAGE(submit_witness2.m_state.IsValid(),
463 "Package validation unexpectedly failed: " << submit_witness2.m_state.GetRejectReason());
465 auto it_parent2_deduped = submit_witness2.m_tx_results.find(ptx_parent->GetWitnessHash());
466 auto it_child2 = submit_witness2.m_tx_results.find(ptx_child2->GetWitnessHash());
467 BOOST_CHECK(it_parent2_deduped != submit_witness2.m_tx_results.end());
469 BOOST_CHECK(it_child2 != submit_witness2.m_tx_results.end());
471 BOOST_CHECK_EQUAL(ptx_child1->GetWitnessHash(), it_child2->second.m_other_wtxid.value());
479 {ptx_parent, ptx_child1},
false);
480 BOOST_CHECK_MESSAGE(submit_segwit_dedup.m_state.IsValid(),
481 "Package validation unexpectedly failed: " << submit_segwit_dedup.m_state.GetRejectReason());
483 auto it_parent_dup = submit_segwit_dedup.m_tx_results.find(ptx_parent->GetWitnessHash());
484 auto it_child_dup = submit_segwit_dedup.m_tx_results.find(ptx_child1->GetWitnessHash());
499 auto mtx_grandchild = CreateValidMempoolTransaction(ptx_child2, 0,
501 grandchild_locking_script,
508 {ptx_child2, ptx_grandchild},
false);
509 BOOST_CHECK_MESSAGE(submit_spend_ignored.m_state.IsValid(),
510 "Package validation unexpectedly failed: " << submit_spend_ignored.m_state.GetRejectReason());
512 auto it_child2_ignored = submit_spend_ignored.m_tx_results.find(ptx_child2->GetWitnessHash());
513 auto it_grandchild = submit_spend_ignored.m_tx_results.find(ptx_grandchild->GetWitnessHash());
514 BOOST_CHECK(it_child2_ignored != submit_spend_ignored.m_tx_results.end());
516 BOOST_CHECK(it_grandchild != submit_spend_ignored.m_tx_results.end());
532 acs_witness.
stack.emplace_back(acs_script.
begin(), acs_script.
end());
535 auto mtx_parent1 = CreateValidMempoolTransaction(m_coinbase_txns[1], 0,
540 package_mixed.push_back(ptx_parent1);
546 parent2_witness1.
stack.emplace_back(1);
547 parent2_witness1.
stack.emplace_back(grandparent2_script.
begin(), grandparent2_script.
end());
549 parent2_witness2.
stack.emplace_back(2);
550 parent2_witness2.
stack.emplace_back(grandparent2_script.
begin(), grandparent2_script.
end());
553 auto mtx_grandparent2 = CreateValidMempoolTransaction(m_coinbase_txns[2], 0,
561 mtx_parent2_v1.
vin.resize(1);
562 mtx_parent2_v1.
vin[0].prevout.hash = ptx_grandparent2->GetHash();
563 mtx_parent2_v1.
vin[0].prevout.n = 0;
565 mtx_parent2_v1.
vin[0].scriptWitness = parent2_witness1;
566 mtx_parent2_v1.
vout.resize(1);
568 mtx_parent2_v1.
vout[0].scriptPubKey = acs_spk;
571 mtx_parent2_v2.
vin[0].scriptWitness = parent2_witness2;
578 package_mixed.push_back(ptx_parent2_v1);
581 auto mtx_parent3 = CreateValidMempoolTransaction(m_coinbase_txns[3], 0,
586 package_mixed.push_back(ptx_parent3);
591 CKey mixed_grandchild_key;
596 mtx_mixed_child.
vin.emplace_back(
COutPoint(ptx_parent1->GetHash(), 0));
597 mtx_mixed_child.
vin.emplace_back(
COutPoint(ptx_parent2_v1->GetHash(), 0));
598 mtx_mixed_child.
vin.emplace_back(
COutPoint(ptx_parent3->GetHash(), 0));
599 mtx_mixed_child.
vin[0].scriptWitness = acs_witness;
600 mtx_mixed_child.
vin[1].scriptWitness = acs_witness;
601 mtx_mixed_child.
vin[2].scriptWitness = acs_witness;
602 mtx_mixed_child.
vout.emplace_back((48 + 49 + 50 - 1) *
COIN, mixed_child_spk);
604 package_mixed.push_back(ptx_mixed_child);
613 BOOST_CHECK_MESSAGE(mixed_result.m_state.IsValid(), mixed_result.m_state.GetRejectReason());
615 auto it_parent1 = mixed_result.m_tx_results.find(ptx_parent1->GetWitnessHash());
616 auto it_parent2 = mixed_result.m_tx_results.find(ptx_parent2_v1->GetWitnessHash());
617 auto it_parent3 = mixed_result.m_tx_results.find(ptx_parent3->GetWitnessHash());
618 auto it_child = mixed_result.m_tx_results.find(ptx_mixed_child->GetWitnessHash());
619 BOOST_CHECK(it_parent1 != mixed_result.m_tx_results.end());
620 BOOST_CHECK(it_parent2 != mixed_result.m_tx_results.end());
621 BOOST_CHECK(it_parent3 != mixed_result.m_tx_results.end());
622 BOOST_CHECK(it_child != mixed_result.m_tx_results.end());
628 BOOST_CHECK_EQUAL(ptx_parent2_v2->GetWitnessHash(), it_parent2->second.m_other_wtxid.value());
638 BOOST_CHECK(it_parent3->second.m_effective_feerate.value() == expected_feerate);
639 BOOST_CHECK(it_child->second.m_effective_feerate.value() == expected_feerate);
640 std::vector<uint256> expected_wtxids({ptx_parent3->GetWitnessHash(), ptx_mixed_child->GetWitnessHash()});
641 BOOST_CHECK(it_parent3->second.m_wtxids_fee_calculations.value() == expected_wtxids);
642 BOOST_CHECK(it_child->second.m_wtxids_fee_calculations.value() == expected_wtxids);
665 auto mtx_parent = CreateValidMempoolTransaction(m_coinbase_txns[0], 0,
668 parent_value,
false);
670 package_cpfp.push_back(tx_parent);
672 auto mtx_child = CreateValidMempoolTransaction(tx_parent, 0,
677 package_cpfp.push_back(tx_child);
682 m_node.
mempool->PrioritiseTransaction(tx_parent->GetHash(), child_value - coinbase_value);
686 package_cpfp,
false);
688 BOOST_CHECK(submit_cpfp_deprio.m_state.IsInvalid());
689 BOOST_CHECK_EQUAL(submit_cpfp_deprio.m_tx_results.find(tx_parent->GetWitnessHash())->second.m_state.GetResult(),
691 BOOST_CHECK_EQUAL(submit_cpfp_deprio.m_tx_results.find(tx_child->GetWitnessHash())->second.m_state.GetResult(),
693 BOOST_CHECK(submit_cpfp_deprio.m_tx_results.find(tx_parent->GetWitnessHash())->second.m_state.GetRejectReason() ==
"min relay fee not met");
706 package_cpfp,
false);
707 expected_pool_size += 2;
708 BOOST_CHECK_MESSAGE(submit_cpfp.m_state.IsValid(),
709 "Package validation unexpectedly failed: " << submit_cpfp.m_state.GetRejectReason());
711 auto it_parent = submit_cpfp.m_tx_results.find(tx_parent->GetWitnessHash());
712 auto it_child = submit_cpfp.m_tx_results.find(tx_child->GetWitnessHash());
713 BOOST_CHECK(it_parent != submit_cpfp.m_tx_results.end());
715 BOOST_CHECK(it_parent->second.m_base_fees.value() == coinbase_value - parent_value);
716 BOOST_CHECK(it_child != submit_cpfp.m_tx_results.end());
724 const CFeeRate expected_feerate(coinbase_value - child_value,
726 BOOST_CHECK(it_parent->second.m_effective_feerate.value() == expected_feerate);
727 BOOST_CHECK(it_child->second.m_effective_feerate.value() == expected_feerate);
728 std::vector<uint256> expected_wtxids({tx_parent->GetWitnessHash(), tx_child->GetWitnessHash()});
729 BOOST_CHECK(it_parent->second.m_wtxids_fee_calculations.value() == expected_wtxids);
730 BOOST_CHECK(it_child->second.m_wtxids_fee_calculations.value() == expected_wtxids);
740 auto mtx_parent_cheap = CreateValidMempoolTransaction(m_coinbase_txns[1], 0,
743 coinbase_value - parent_fee,
false);
745 package_still_too_low.push_back(tx_parent_cheap);
749 auto mtx_child_cheap = CreateValidMempoolTransaction(tx_parent_cheap, 0,
752 coinbase_value - parent_fee - child_fee,
false);
754 package_still_too_low.push_back(tx_child_cheap);
762 package_still_too_low,
false);
763 BOOST_CHECK_MESSAGE(submit_package_too_low.m_state.IsInvalid(),
"Package validation unexpectedly succeeded");
765 BOOST_CHECK_EQUAL(submit_package_too_low.m_state.GetRejectReason(),
"package-fee-too-low");
775 package_still_too_low,
false);
776 expected_pool_size += 2;
777 BOOST_CHECK_MESSAGE(submit_prioritised_package.m_state.IsValid(),
778 "Package validation unexpectedly failed" << submit_prioritised_package.m_state.GetRejectReason());
779 const CFeeRate expected_feerate(1 *
COIN + parent_fee + child_fee,
781 BOOST_CHECK_EQUAL(submit_prioritised_package.m_tx_results.size(), package_still_too_low.size());
782 auto it_parent = submit_prioritised_package.m_tx_results.find(tx_parent_cheap->GetWitnessHash());
783 auto it_child = submit_prioritised_package.m_tx_results.find(tx_child_cheap->GetWitnessHash());
784 BOOST_CHECK(it_parent != submit_prioritised_package.m_tx_results.end());
786 BOOST_CHECK(it_parent->second.m_base_fees.value() == parent_fee);
787 BOOST_CHECK(it_parent->second.m_effective_feerate.value() == expected_feerate);
788 BOOST_CHECK(it_child != submit_prioritised_package.m_tx_results.end());
790 BOOST_CHECK(it_child->second.m_base_fees.value() == child_fee);
791 BOOST_CHECK(it_child->second.m_effective_feerate.value() == expected_feerate);
792 std::vector<uint256> expected_wtxids({tx_parent_cheap->GetWitnessHash(), tx_child_cheap->GetWitnessHash()});
793 BOOST_CHECK(it_parent->second.m_wtxids_fee_calculations.value() == expected_wtxids);
794 BOOST_CHECK(it_child->second.m_wtxids_fee_calculations.value() == expected_wtxids);
804 auto mtx_parent_rich = CreateValidMempoolTransaction(m_coinbase_txns[2], 0,
807 coinbase_value - high_parent_fee,
false);
809 package_rich_parent.push_back(tx_parent_rich);
811 auto mtx_child_poor = CreateValidMempoolTransaction(tx_parent_rich, 0,
814 coinbase_value - high_parent_fee,
false);
816 package_rich_parent.push_back(tx_child_poor);
822 package_rich_parent,
false);
823 expected_pool_size += 1;
824 BOOST_CHECK_MESSAGE(submit_rich_parent.m_state.IsInvalid(),
"Package validation unexpectedly succeeded");
828 BOOST_CHECK_EQUAL(submit_rich_parent.m_state.GetRejectReason(),
"transaction failed");
830 auto it_parent = submit_rich_parent.m_tx_results.find(tx_parent_rich->GetWitnessHash());
831 auto it_child = submit_rich_parent.m_tx_results.find(tx_child_poor->GetWitnessHash());
832 BOOST_CHECK(it_parent != submit_rich_parent.m_tx_results.end());
833 BOOST_CHECK(it_child != submit_rich_parent.m_tx_results.end());
836 BOOST_CHECK(it_parent->second.m_state.GetRejectReason() ==
"");
837 BOOST_CHECK_MESSAGE(it_parent->second.m_base_fees.value() == high_parent_fee,
838 strprintf(
"rich parent: expected fee %s, got %s", high_parent_fee, it_parent->second.m_base_fees.value()));
840 BOOST_CHECK(it_child != submit_rich_parent.m_tx_results.end());
843 BOOST_CHECK(it_child->second.m_state.GetRejectReason() ==
"min relay fee not met");
std::shared_ptr< const CTransaction > CTransactionRef
static GenTxid Wtxid(const uint256 &hash)
The package itself is invalid (e.g. too many transactions).
Valid, transaction was already in the mempool.
bool IsChildWithParents(const Package &package)
Context-free check that a package is exactly one child and its parents; not all parents need to be pr...
CPubKey GetPubKey() const
Compute the public key from a private key.
std::vector< CTransactionRef > Package
A package is an ordered list of transactions.
transaction was missing some of its inputs
BOOST_FIXTURE_TEST_CASE(package_sanitization_tests, TestChain100Setup)
std::vector< std::vector< unsigned char > > stack
bool IsChildWithParentsTree(const Package &package)
Context-free check that a package IsChildWithParents() and none of the parents depend on each other (...
violated mempool's fee/size/descendant/RBF/etc limits
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
const ResultType m_result_type
Result type.
bool CheckPackage(const Package &txns, PackageValidationState &state)
Context-free package policy checks:
static int32_t GetTransactionWeight(const CTransaction &tx)
std::unique_ptr< CTxMemPool > mempool
static constexpr unsigned int DEFAULT_ANCESTOR_SIZE_LIMIT_KVB
Default for -limitancestorsize, maximum kilobytes of tx + all in-mempool ancestors.
int64_t CAmount
Amount in satoshis (Can be negative)
Transaction might have a witness prior to SegWit activation, or witness may have been malleated (whic...
BOOST_AUTO_TEST_SUITE_END()
void MakeNewKey(bool fCompressed)
Generate a new private key using a cryptographic PRNG.
PackageMempoolAcceptResult ProcessNewPackage(Chainstate &active_chainstate, CTxMemPool &pool, const Package &package, bool test_accept)
Validate (and maybe submit) a package to the mempool.
At least one tx is invalid.
Testing fixture that pre-creates a 100-block REGTEST-mode block chain.
An outpoint - a combination of a transaction hash and an index n into its vout.
static uint256 InsecureRand256()
std::vector< CTxOut > vout
Validation result for a single transaction mempool acceptance.
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::vector< unsigned char > ToByteVector(const T &in)
void Shuffle(I first, I last, R &&rng)
More efficient than using std::shuffle on a FastRandomContext.
static const CAmount low_fee_amt
#define BOOST_CHECK_EQUAL(v1, v2)
Serialized script, used inside transaction inputs and outputs.
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
BOOST_AUTO_TEST_SUITE(cuckoocache_tests)
Test Suite for CuckooCache.
A mutable version of CTransaction.
static constexpr CAmount CENT
static constexpr uint32_t MAX_PACKAGE_COUNT
Default maximum number of transactions in a package.
An encapsulated private key.
std::string GetRejectReason() const
CTransactionRef create_placeholder_tx(size_t num_inputs, size_t num_outputs)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate...
std::unique_ptr< ChainstateManager > chainman
static GenTxid Txid(const uint256 &hash)
#define BOOST_CHECK(expr)
static constexpr uint32_t MAX_PACKAGE_WEIGHT
Default maximum total weight of transactions in a package in weight to allow for context-less checks...
static constexpr CAmount COIN
The amount of satoshis in one BTC.