Commit Graph

6 Commits

Author SHA1 Message Date
Sebastian Falbesoner
d516cf83ed test: use built-in collection types for type hints (Python 3.9 / PEP 585)
Since Python 3.9, type hinting has become a little less awkward, as for
collection types one doesn't need to import the corresponding
capitalized types (`Dict`, `List`, `Set`, `Tuple`, ...) anymore, but can
use the built-in types directly. [1] [2]
This commit applies the replacement for all Python scripts (i.e. in the
contrib and test folders) for the basic types:
    - typing.Dict  -> dict
    - typing.List  -> list
    - typing.Set   -> set
    - typing.Tuple -> tuple

[1] https://docs.python.org/3.9/whatsnew/3.9.html#type-hinting-generics-in-standard-collections
[2] https://peps.python.org/pep-0585/#implementation for a list of type
2023-10-25 01:10:21 +02:00
Hennadii Stepanov
306ccd4927
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-

Commits of previous years:
- 2021: f47dda2c58
- 2020: fa0074e2d8
- 2019: aaaaad6ac9
2022-12-24 23:49:50 +00:00
Sebastian Falbesoner
644772b9ef message-capture-parser: fix AssertionError on parsing headers message
If a test framework message's field name is in the list of
`HASH_INT_VECTORS`, we currently assume that it _always_ has to contain
a vector of integers and throw otherwise (introduced in PR #25367,
commit 42bbbba7c8). However, that
assumption is too strict. In this concrete case, the (de)serialization
field name "headers" is used in two different message types, one for
`cfcheckpt` (where it is serialized as an integer vector), and another
time for `headers` (where it is serialized as a vector of
`CBlockHeader`s). Fix by adding the integer type check as additional
condition to the `HASH_INT_VECTORS` check rather than asserting.
Fixes #25954.
2022-09-05 00:30:54 +02:00
Sebastian Falbesoner
42bbbba7c8 message-capture-parser: fix out of bounds error for empty vectors 2022-06-14 14:28:50 +02:00
Troy Giorshev
bff7c66e67 Add documentation to contrib folder
This commit adds brief documentation for this feature.  Included in the
justification is the purpose of this feature as well as usage and
functionality tips.
2021-01-23 16:15:05 -05:00
Troy Giorshev
e4f378a505 Add capture parser
This commit adds contrib/message-capture/message-capture-parser.py, a python
script to be used alongside -capturemessages to parse the captured
messages.

It is complete with arguments and will parse any file given, sorting the
messages in the files when creating the output.  If an output file is
specified with -o or --output, it will dump the messages in json format
to that file, otherwise it will print to stdout.

The small change to the unused msg_generic is to bring it in line with
the other message classes, purely to avoid a bug in the future.
2021-01-23 16:01:39 -05:00