qa: mininode: Clearer error message on invalid magic bytes #15631

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:1903-qaMagicMininode changing 1 files +1 −1
  1. MarcoFalke commented at 9:19 PM on March 20, 2019: member

    Old message:

    ValueError: got garbage b'\xfa\xbf\xb5\xdafeefilter\x00\x00\x00\x08\x00\x00\x00\xe8\x0f\xd1\x9f\xe8\x03\x00\x00\x00\x00\x00\x00'
    

    New message:

    ValueError: magic bytes mismatch: b'\x00\x11"2' != b'\xfa\xbf\xb5\xdapong\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x97\xe6\x04\xd2\xff\x00\x00\x00\x00\x00\x00\x00'
    
  2. qa: mininode: Clearer error message on invalid magic bytes fab0a68aa2
  3. DrahtBot added the label Tests on Mar 20, 2019
  4. in test/functional/test_framework/mininode.py:174 in fab0a68aa2
     170 | @@ -171,7 +171,7 @@ def _on_data(self):
     171 |                  if len(self.recvbuf) < 4:
     172 |                      return
     173 |                  if self.recvbuf[:4] != self.magic_bytes:
     174 | -                    raise ValueError("got garbage %s" % repr(self.recvbuf))
     175 | +                    raise ValueError("magic bytes mismatch: {} != {}".format(repr(self.magic_bytes), repr(self.recvbuf)))
    


    practicalswift commented at 9:31 PM on March 20, 2019:
                        raise ValueError("magic bytes mismatch: {} != {}".format(repr(self.magic_bytes), repr(self.recvbuf[:4])))
    

    MarcoFalke commented at 9:36 PM on March 20, 2019:

    Would still be nice to see the message type


    practicalswift commented at 9:47 PM on March 20, 2019:

    That's a good point. Reverting my suggestion :-)


    practicalswift commented at 2:35 PM on March 21, 2019:
                        raise ValueError("magic bytes mismatch: received {} which does not start with the expected {}".format(repr(self.recvbuf), repr(self.magic_bytes)))
    

    promag commented at 2:43 PM on March 21, 2019:

    Was going to suggest something like this.

  5. practicalswift changes_requested
  6. practicalswift commented at 9:32 PM on March 20, 2019: contributor

    Concept ACK

  7. practicalswift changes_requested
  8. laanwj commented at 8:57 AM on March 22, 2019: member

    Much better message, utACK fab0a68aa25191a532f26cf8e227f456b853d8f1

  9. MarcoFalke referenced this in commit 68520597cc on Mar 22, 2019
  10. MarcoFalke merged this on Mar 22, 2019
  11. MarcoFalke closed this on Mar 22, 2019

  12. MarcoFalke deleted the branch on Mar 22, 2019
  13. deadalnix referenced this in commit 25ce183dcc on Oct 21, 2020
  14. Munkybooty referenced this in commit 1b5fe17a11 on Sep 22, 2021
  15. Munkybooty referenced this in commit 73acf4fdb4 on Sep 27, 2021
  16. Munkybooty referenced this in commit a98e85f05f on Sep 27, 2021
  17. Munkybooty referenced this in commit 75d0a263fb on Sep 27, 2021
  18. Munkybooty referenced this in commit 014017b041 on Sep 30, 2021
  19. Munkybooty referenced this in commit 6f4fbaa641 on Oct 1, 2021
  20. Munkybooty referenced this in commit 3c674812f3 on Oct 1, 2021
  21. kittywhiskers referenced this in commit 706d0da315 on Oct 12, 2021
  22. pravblockc referenced this in commit 6015302336 on Nov 18, 2021
  23. DrahtBot locked this on Dec 16, 2021

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-17 06:15 UTC

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