test: assumeutxo file with unknown block hash #28666

pull fjahr wants to merge 1 commits into bitcoin:master from fjahr:2023-10-au-tests-2 changing 1 files +8 −7
  1. fjahr commented at 3:01 pm on October 17, 2023: contributor
    Takes care of one of the open Todos in the assumeutxo functional test. Since an unknown block could be any hash, I simply chose one placeholder, it could also be a random string though.
  2. DrahtBot commented at 3:01 pm on October 17, 2023: contributor

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

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, pablomartin4btc, theStack, ryanofsky

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #28659 (assumeutxo, rpc: Add ‘start’ parameter to loadtxoutset by hernanmarino)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  3. DrahtBot added the label Tests on Oct 17, 2023
  4. in test/functional/feature_assumeutxo.py:84 in 5958f7b86f outdated
    78@@ -80,6 +79,14 @@ def test_invalid_snapshot_scenarios(self, valid_snapshot_path):
    79         error_details = f"assumeutxo block hash in snapshot metadata not recognized ({bad_snapshot_block_hash})"
    80         assert_raises_rpc_error(-32603, f"Unable to load UTXO snapshot, {error_details}", self.nodes[1].loadtxoutset, bad_snapshot_path)
    81 
    82+        self.log.info("  - snapshot file refering to a block that is unknown")
    83+        # Represents any unknown block hash
    84+        bogus_block_hash = "0" * 64
    


    maflcko commented at 3:06 pm on October 17, 2023:
    nit: Could use a for-loop, as this code is copied from above and testing the exactly same thing?

    fjahr commented at 3:13 pm on October 17, 2023:
    mostly, I guess having a different log output isn’t that essential though, so using a loop now
  5. maflcko commented at 3:06 pm on October 17, 2023: member
    lgtm ACK 5958f7b86fb9e11406552cdf7b55055cf65d202b
  6. test: assumeutxo file with unknown block hash 621db2f004
  7. fjahr force-pushed on Oct 17, 2023
  8. maflcko commented at 3:14 pm on October 17, 2023: member
    lgtm ACK 621db2f00486d8fd6f06dca91c1b95ce61f64bc4
  9. fanquake added this to the milestone 26.0 on Oct 17, 2023
  10. in test/functional/feature_assumeutxo.py:76 in 621db2f004
    77-            # block hash of the snapshot base is stored right at the start (first 32 bytes)
    78-            f.write(bytes.fromhex(bad_snapshot_block_hash)[::-1] + valid_snapshot_contents[32:])
    79-        error_details = f"assumeutxo block hash in snapshot metadata not recognized ({bad_snapshot_block_hash})"
    80-        assert_raises_rpc_error(-32603, f"Unable to load UTXO snapshot, {error_details}", self.nodes[1].loadtxoutset, bad_snapshot_path)
    81+        prev_block_hash = self.nodes[0].getblockhash(SNAPSHOT_BASE_HEIGHT - 1)
    82+        bogus_block_hash = "0" * 64  # Represents any unknown block hash
    


    pablomartin4btc commented at 3:40 pm on October 17, 2023:

    This is good. nit:

    0        bogus_block_hash = "0" * 64  # Represents any invalid/ not recognized block hash
    
  11. pablomartin4btc commented at 3:40 pm on October 17, 2023: contributor
    cr ACK 621db2f00486d8fd6f06dca91c1b95ce61f64bc4
  12. theStack approved
  13. theStack commented at 3:47 pm on October 17, 2023: contributor
    ACK 621db2f00486d8fd6f06dca91c1b95ce61f64bc4
  14. ryanofsky approved
  15. ryanofsky commented at 4:12 pm on October 17, 2023: contributor
    Code review ACK 621db2f00486d8fd6f06dca91c1b95ce61f64bc4
  16. maflcko assigned ryanofsky on Oct 18, 2023
  17. ryanofsky merged this on Oct 18, 2023
  18. ryanofsky closed this on Oct 18, 2023


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: 2024-07-08 22:13 UTC

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