10#include <boost/test/unit_test.hpp>
55 std::vector<TxGraph::Ref>
refs;
62 for (
unsigned int i = 0; i <
NUM_TOP_TX; ++i) {
88 for (
unsigned int i = 0; i <
refs.size(); ++i) {
118 std::vector<TxGraph::Ref>
refs;
122 graph->AddTransaction(
refs.emplace_back(), {1, 100});
123 for (
unsigned int i = 0; i <
NUM_TOP_TX; ++i) {
126 graph->SanityCheck();
130 graph->AddDependency(
refs[i],
refs[0]);
132 graph->SanityCheck();
140 graph->SanityCheck();
147 for (
unsigned int i = 1; i <
refs.size(); ++i) {
209 graph->AddTransaction(
top_refs.emplace_back(), feerate);
218 graph->SanityCheck();
229 graph->AddTransaction(
bottom_tx, feerate);
232 for (
int dep = 0; dep <
deps; ++dep) {
239 if (dep <
deps - 1) {
248 graph->SanityCheck();
260 graph->SanityCheck();
277 std::vector<TxGraph::Ref>
refs;
285 graph->AddTransaction(
refs.emplace_back(), feerate);
287 graph->SanityCheck();
295 graph->SanityCheck();
300 for (
unsigned int i = 0; i <
refs.size(); ++i) {
311 std::vector<std::vector<TxGraph::Ref*>>
chunks;
312 auto builder = graph->GetBlockBuilder();
321 sum += graph->GetIndividualFeerate(*ref);
338 std::vector<TxGraph::Ref>
refs;
353 graph->AddDependency(
refs[0],
refs[1]);
359 graph->AddDependency(
refs[1],
refs[2]);
365 graph->AddDependency(
refs[2],
refs[3]);
369 graph->SanityCheck();
372 graph->RemoveTransaction(
refs[1]);
376 graph->RemoveTransaction(
refs[2]);
377 graph->RemoveTransaction(
refs[3]);
389 std::vector<TxGraph::Ref>
refs;
401 graph->StartStaging();
412 graph->AddDependency(
refs[0],
refs[1]);
416 graph->CommitStaging();
421 graph->StartStaging();
424 graph->RemoveTransaction(
refs[1]);
428 graph->CommitStaging();
432 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.