test: add fee timer blocking test coverage#70
test: add fee timer blocking test coverage#70xyephy wants to merge 2 commits intostratum-mining:masterfrom
Conversation
| TPTester tester{opts}; | ||
|
|
||
| tester.handshake(); | ||
| tester.handshake(); |
There was a problem hiding this comment.
I don't know why the original has two handshake calls, that might be a bug.
It would be good to reduce the amount of duplicated test code, that also makes it more clear how each test case is different.
There was a problem hiding this comment.
let me do a clean up and have a much clearer approach
There was a problem hiding this comment.
d54d4b7 is better, but the code between coinbase_output_constraint_bytes and BOOST_REQUIRE_EQUAL(initial_bytes, expected_pair_bytes) is still duplicated. Can you extract that into one or more helpers?
There was a problem hiding this comment.
yes, I have addressed it in ef1a258 . Thank you.
fffb55b to
d54d4b7
Compare
Does that mean the TODO can go away? |
yes |
d54d4b7 to
ef1a258
Compare
| } | ||
|
|
||
| BOOST_REQUIRE_MESSAGE(seen_prev_hash, std::string("Missing SetNewPrevHash during ") + context); | ||
| BOOST_REQUIRE_MESSAGE(seen_new_template, std::string("Missing NewTemplate during ") + context); |
There was a problem hiding this comment.
Looks like you've lost part of this entire test now?
There was a problem hiding this comment.
I've restored the lost bit
There was a problem hiding this comment.
that's a good catch, let me reset and redo. Thank you
|
It's (slightly) easier to review the deduplication commit if you do it first. |
ef1a258 to
cfe50cd
Compare
| // -sv2interval=N requires that we don't send fee updates until at least | ||
| // N seconds have gone by. So we first call waitNext() without a fee | ||
| // threshold, and then on the next while iteration we set it. | ||
| // TODO: add test coverage |
There was a problem hiding this comment.
05585cd: nit, this in the wrong commit now (don't worry about it)
There was a problem hiding this comment.
let me do a better cleanup, thank you.
Extract SendSetupConnection(), SendCoinbaseOutputConstraints(), and ReceiveTemplatePair() into TPTester to reduce duplication in client_tests. Add TPTester(Sv2TemplateProviderOptions) constructor for custom options. Remove duplicate tester.handshake() call.
Exercise the -sv2interval timer logic with is_test=false and a 2s fee_check_interval. Verifies that fee increases are blocked while the timer is active and allowed after it fires.
cfe50cd to
1d3013e
Compare
Add test coverage for the fee-based rate limiting timer that was marked with a TODO in template_provider.cpp. The timer blocks fee-based template updates until fee_check_interval seconds have passed (-sv2interval flag).
The test uses is_test=false to exercise the actual timer logic that is normally bypassed in tests. It verifies:
Also adds a TPTester constructor overload to accept custom options, allowing tests to configure is_test and fee_check_interval independently.
Closes #67