test: get rid of redundant TODO tag #32058

pull Chand-ra wants to merge 1 commits into bitcoin:master from Chand-ra:todo-v1 changing 1 files +1 −1
  1. Chand-ra commented at 1:28 pm on March 13, 2025: none
    The FEE parameter in test/functional/feature_dbcrash.py::generate_small_transaction() is not a fee rate, but an absolute fee. Hence, it doesn’t make sense to replace it with node relay based fee calculation. Get rid of the TODO comment suggesting otherwise.
  2. DrahtBot commented at 1:28 pm on March 13, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32058.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko
    Concept ACK yancyribbens, kevkevinpal

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. DrahtBot added the label Tests on Mar 13, 2025
  4. yancyribbens commented at 4:53 pm on March 14, 2025: contributor
    Concept ACK. The changes appear to address the TODO correctly.
  5. in test/functional/feature_dbcrash.py:189 in 6aff347734 outdated
    183@@ -184,7 +184,9 @@ def verify_utxo_hash(self):
    184             assert_equal(nodei_utxo_hash, node3_utxo_hash)
    185 
    186     def generate_small_transactions(self, node, count, utxo_list):
    187-        FEE = 1000  # TODO: replace this with node relay fee based calculation
    188+        relay_fee_btc = float(node.rpc.getmempoolinfo()["minrelaytxfee"])
    189+        relay_fee_sat = int(relay_fee_btc * COIN)
    190+        FEE = relay_fee_sat
    


    maflcko commented at 4:20 pm on March 16, 2025:

    not sure about using float and then int again. Why is this needed?

    Also, changing FEE may change the test logic, so it seems better to adjust manually

    It would be best to just add an assert_equal(FEE, minrelaytxfee)


    Chand-ra commented at 5:03 pm on March 16, 2025:

    not sure about using float and then int again. Why is this needed?

    The fee in satoshis must be integer, so I added those as a precautionary measure. Looking back at it, they do seem redundant.

    Also, changing FEE may change the test logic, so it seems better to adjust manually

    Isn’t that the point of the change suggested by the TODO tag though? To make FEE adapt dynamically to a change in minRelayTxFee?


    maflcko commented at 7:34 am on March 25, 2025:

    Many other tests do it the same way. See for example test/functional/p2p_1p1c_network.py.

    If you wanted to change that, you’d have to go through all tests and check them for applicable changes, but I don’t really see the point to do that without rationale.

  6. kevkevinpal commented at 11:57 am on March 21, 2025: contributor

    Concept ACK 6aff347

    This looks to address the TODO correctly

  7. Chand-ra force-pushed on Mar 25, 2025
  8. in test/functional/feature_dbcrash.py:190 in d99a599090 outdated
    183@@ -184,7 +184,10 @@ def verify_utxo_hash(self):
    184             assert_equal(nodei_utxo_hash, node3_utxo_hash)
    185 
    186     def generate_small_transactions(self, node, count, utxo_list):
    187-        FEE = 1000  # TODO: replace this with node relay fee based calculation
    188+        FEE = 1000
    189+        relay_fee_btc = node.rpc.getmempoolinfo()["minrelaytxfee"]
    190+        relay_fee_sat = relay_fee_btc * COIN
    191+        assert_equal(FEE, relay_fee_sat)
    


    maflcko commented at 12:52 pm on March 25, 2025:

    Actually, FEE here isn’t a fee rate at all, but an absolute fee.

    So it seems fine to just remove the todo and and assert completely.


    Chand-ra commented at 1:41 pm on March 25, 2025:
    Makes sense.
  9. maflcko commented at 2:12 pm on March 25, 2025: member
  10. test: get rid of redundant TODO tag
    The 'FEE' parameter in test/functional/feature_dbcrash.py::
    generate_small_transaction() is not a fee rate, but an
    absolute fee. Hence, it doesn't make sense to replace it
    with node relay based fee calculation. Get rid of the TODO
    comment suggesting otherwise.
    d065208f0f
  11. Chand-ra force-pushed on Mar 26, 2025
  12. Chand-ra renamed this:
    test: replace hardcoded fee with node relay fee based calculation
    test: get rid of redundant TODO tag
    on Mar 26, 2025
  13. maflcko commented at 11:44 am on March 27, 2025: member
    lgtm ACK d065208f0f06309d776114d777bb16b8c38af3f1
  14. fanquake merged this on Mar 28, 2025
  15. fanquake closed this on Mar 28, 2025


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-03-28 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me