| 64 | } |
| 65 | |
| 66 | static void TestFillInputToWeight(int64_t additional_weight, std::vector<int64_t> expected_stack_sizes) |
| 67 | { |
| 68 | CMutableTransaction mtx; |
| 69 | mtx.vin.resize(1); |
| 70 | mtx.witness.vtxinwit.resize(1); |
| 71 | static const int64_t EMPTY_INPUT_WEIGHT = GetTransactionInputWeight(CTransaction(mtx), 0); |
| 72 | |
| 73 | CTxIn input; |
| 74 | int64_t target_weight = EMPTY_INPUT_WEIGHT + additional_weight; |
| 75 | size_t nIn{0}; |
| 76 | BOOST_CHECK(FillInputToWeight(mtx, nIn, target_weight)); |
| 77 | BOOST_CHECK_EQUAL(GetTransactionInputWeight(CTransaction(mtx), nIn), target_weight); |
| 78 | BOOST_CHECK_EQUAL(mtx.witness.vtxinwit[nIn].scriptWitness.stack.size(), expected_stack_sizes.size()); |
| 79 | for (unsigned int i = 0; i < expected_stack_sizes.size(); ++i) { |
| 80 | BOOST_CHECK_EQUAL(mtx.witness.vtxinwit[nIn].scriptWitness.stack[i].size(), expected_stack_sizes[i]); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | BOOST_FIXTURE_TEST_CASE(FillInputToWeightTest, BasicTestingSetup) |
| 85 | { |
no test coverage detected