Skip to content

Commit b222138

Browse files
committed
Merge bitcoin#13457: tests: Drop variadic macro
faf52f9 tests: Drop variadic macro (MarcoFalke) Pull request description: The C++11 constructor of `std::vector` that takes an initializer list, is not `explicit`. Thus, the macro is not required and can be dropped. Hopefully fixes bitcoin#13456 Tree-SHA512: 4095ed205f88138a7cd5b14790cc426899966f622a924a9b3f7de646a0d801a48ffb8921da760f1f93d5481298477c8a64dbec291381bb9aa77b075bdd2659f2
2 parents 4382f19 + faf52f9 commit b222138

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Diff for: src/test/mempool_tests.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,6 @@ inline CTransactionRef make_tx(std::vector<CAmount>&& output_values, std::vector
587587
return MakeTransactionRef(tx);
588588
}
589589

590-
#define MK_OUTPUTS(amounts...) std::vector<CAmount>{amounts}
591-
#define MK_INPUTS(txs...) std::vector<CTransactionRef>{txs}
592-
#define MK_INPUT_IDX(idxes...) std::vector<uint32_t>{idxes}
593590

594591
BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
595592
{
@@ -602,7 +599,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
602599
//
603600
// [tx1]
604601
//
605-
CTransactionRef tx1 = make_tx(MK_OUTPUTS(10 * COIN));
602+
CTransactionRef tx1 = make_tx(/* output_values */ {10 * COIN});
606603
pool.addUnchecked(tx1->GetHash(), entry.Fee(10000LL).FromTx(tx1));
607604

608605
// Ancestors / descendants should be 1 / 1 (itself / itself)
@@ -614,7 +611,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
614611
//
615612
// [tx1].0 <- [tx2]
616613
//
617-
CTransactionRef tx2 = make_tx(MK_OUTPUTS(495 * CENT, 5 * COIN), MK_INPUTS(tx1));
614+
CTransactionRef tx2 = make_tx(/* output_values */ {495 * CENT, 5 * COIN}, /* inputs */ {tx1});
618615
pool.addUnchecked(tx2->GetHash(), entry.Fee(10000LL).FromTx(tx2));
619616

620617
// Ancestors / descendants should be:
@@ -633,7 +630,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
633630
//
634631
// [tx1].0 <- [tx2].0 <- [tx3]
635632
//
636-
CTransactionRef tx3 = make_tx(MK_OUTPUTS(290 * CENT, 200 * CENT), MK_INPUTS(tx2));
633+
CTransactionRef tx3 = make_tx(/* output_values */ {290 * CENT, 200 * CENT}, /* inputs */ {tx2});
637634
pool.addUnchecked(tx3->GetHash(), entry.Fee(10000LL).FromTx(tx3));
638635

639636
// Ancestors / descendants should be:
@@ -658,7 +655,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
658655
// |
659656
// \---1 <- [tx4]
660657
//
661-
CTransactionRef tx4 = make_tx(MK_OUTPUTS(290 * CENT, 250 * CENT), MK_INPUTS(tx2), MK_INPUT_IDX(1));
658+
CTransactionRef tx4 = make_tx(/* output_values */ {290 * CENT, 250 * CENT}, /* inputs */ {tx2}, /* input_indices */ {1});
662659
pool.addUnchecked(tx4->GetHash(), entry.Fee(10000LL).FromTx(tx4));
663660

664661
// Ancestors / descendants should be:
@@ -694,14 +691,14 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
694691
CAmount v = 5 * COIN;
695692
for (uint64_t i = 0; i < 5; i++) {
696693
CTransactionRef& tyi = *ty[i];
697-
tyi = make_tx(MK_OUTPUTS(v), i > 0 ? MK_INPUTS(*ty[i-1]) : std::vector<CTransactionRef>());
694+
tyi = make_tx(/* output_values */ {v}, /* inputs */ i > 0 ? std::vector<CTransactionRef>{*ty[i - 1]} : std::vector<CTransactionRef>{});
698695
v -= 50 * CENT;
699696
pool.addUnchecked(tyi->GetHash(), entry.Fee(10000LL).FromTx(tyi));
700697
pool.GetTransactionAncestry(tyi->GetHash(), ancestors, descendants);
701698
BOOST_CHECK_EQUAL(ancestors, i+1);
702699
BOOST_CHECK_EQUAL(descendants, i+1);
703700
}
704-
CTransactionRef ty6 = make_tx(MK_OUTPUTS(5 * COIN), MK_INPUTS(tx3, ty5));
701+
CTransactionRef ty6 = make_tx(/* output_values */ {5 * COIN}, /* inputs */ {tx3, ty5});
705702
pool.addUnchecked(ty6->GetHash(), entry.Fee(10000LL).FromTx(ty6));
706703

707704
// Ancestors / descendants should be:

0 commit comments

Comments
 (0)