9#include <boost/test/unit_test.hpp>
54 std::vector<TxGraph::Ref>
refs;
61 for (
unsigned int i = 0; i <
NUM_TOP_TX; ++i) {
87 for (
unsigned int i = 0; i <
refs.size(); ++i) {
117 std::vector<TxGraph::Ref>
refs;
121 graph->AddTransaction(
refs.emplace_back(), {1, 100});
122 for (
unsigned int i = 0; i <
NUM_TOP_TX; ++i) {
125 graph->SanityCheck();
129 graph->AddDependency(
refs[i],
refs[0]);
131 graph->SanityCheck();
139 graph->SanityCheck();
146 for (
unsigned int i = 1; i <
refs.size(); ++i) {
208 graph->AddTransaction(
top_refs.emplace_back(), feerate);
217 graph->SanityCheck();
228 graph->AddTransaction(
bottom_tx, feerate);
231 for (
int dep = 0; dep <
deps; ++dep) {
238 if (dep <
deps - 1) {
247 graph->SanityCheck();
259 graph->SanityCheck();
276 std::vector<TxGraph::Ref>
refs;
284 graph->AddTransaction(
refs.emplace_back(), feerate);
286 graph->SanityCheck();
294 graph->SanityCheck();
299 for (
unsigned int i = 0; i <
refs.size(); ++i) {
310 std::vector<std::vector<TxGraph::Ref*>>
chunks;
311 auto builder = graph->GetBlockBuilder();
320 sum += graph->GetIndividualFeerate(*ref);
337 std::vector<TxGraph::Ref>
refs;
352 graph->AddDependency(
refs[0],
refs[1]);
358 graph->AddDependency(
refs[1],
refs[2]);
364 graph->AddDependency(
refs[2],
refs[3]);
368 graph->SanityCheck();
371 graph->RemoveTransaction(
refs[1]);
375 graph->RemoveTransaction(
refs[2]);
376 graph->RemoveTransaction(
refs[3]);
388 std::vector<TxGraph::Ref>
refs;
400 graph->StartStaging();
411 graph->AddDependency(
refs[0],
refs[1]);
415 graph->CommitStaging();
420 graph->StartStaging();
423 graph->RemoveTransaction(
refs[1]);
427 graph->CommitStaging();
431 graph->SanityCheck();
I randrange(I range) noexcept
Generate a random integer in the range [0..range), with range > 0.
uint64_t randbits(int bits) noexcept
Generate a random (bits)-bit integer.
@ MAIN
Always refers to the main graph, whether staging is present or not.
@ TOP
Refers to staging if it exists, main otherwise.
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
Tagged wrapper around FeeFrac to avoid unit confusion.
std::unique_ptr< TxGraph > MakeTxGraph(unsigned max_cluster_count, uint64_t max_cluster_size, uint64_t acceptable_cost, const std::function< std::strong_ordering(const TxGraph::Ref &, const TxGraph::Ref &)> &fallback_order) noexcept
Construct a new TxGraph with the specified limit on the number of transactions within a cluster,...
BOOST_AUTO_TEST_CASE(txgraph_trim_zigzag)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.