test: refactor: replace unnecessary `BytesIO` uses #27389

pull theStack wants to merge 1 commits into bitcoin:master from theStack:202204-test-nuke_bytesio changing 3 files +9 −15
  1. theStack commented at 12:21 PM on April 1, 2023: contributor

    Rather than needing to create intermediate stream variables, we can use helper functions like tx_from_hex instead or access the result directly, leading both to increased readability and less code.

  2. test: refactor: replace unnecessary `BytesIO` uses
    Rather than needing to create intermediate stream variables, we can use
    helper functions like `tx_from_hex` instead or access the result
    directly, leading both to increased readability and less code.
    f842ed9a40
  3. DrahtBot commented at 12:21 PM on April 1, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK stickies-v, brunoerg, aureleoules

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #26415 (rpc,rest,zmq: faster getblock, NotifyBlock and rest_block by reading raw block by andrewtoth)

    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.

  4. DrahtBot added the label Tests on Apr 1, 2023
  5. in test/functional/interface_rest.py:161 in f842ed9a40
     157 | @@ -160,12 +158,11 @@ def run_test(self):
     158 |          bin_request = b'\x01\x02'
     159 |          for txid, n in [spending, spent]:
     160 |              bin_request += bytes.fromhex(txid)
     161 | -            bin_request += pack("i", n)
     162 | +            bin_request += n.to_bytes(4, 'little')
    


    stickies-v commented at 11:01 AM on April 3, 2023:

    nit: I suppose technically this is behaviour change, since we're going from default endianness to little endianness? But I suspect previously the test would have failed on big endian platforms, and being explicit is a strict improvement. Just flagging in case it does lead to weird behaviour somewhere.

  6. stickies-v approved
  7. stickies-v commented at 11:01 AM on April 3, 2023: contributor

    ACK f842ed9a40c0db656b86f85e84dd4978865cc0a0

    Easier to read, less duplication.

  8. brunoerg approved
  9. brunoerg commented at 5:13 PM on April 3, 2023: contributor

    crACK f842ed9a40c0db656b86f85e84dd4978865cc0a0

  10. aureleoules approved
  11. aureleoules commented at 5:58 PM on April 3, 2023: member

    ACK f842ed9a40c0db656b86f85e84dd4978865cc0a0 - It seems that these are the only instances that can be changed and it simplifies test code.

  12. fanquake merged this on Apr 4, 2023
  13. fanquake closed this on Apr 4, 2023

  14. theStack deleted the branch on Apr 4, 2023
  15. sidhujag referenced this in commit ec54ff4665 on Apr 4, 2023
  16. bitcoin locked this on Apr 3, 2024

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: 2026-04-14 21:13 UTC

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