While working on the test for #19776 I noticed that creating a sendcmpct message is quite cumbersome -- due to the lack of a parameterized constructor, one needs to create an empty (that is, initialized with default values) object and then set the two fields one by one. This PR replaces the default constructor with a parameterized constructor and uses it in the test p2p_compactblocks.py, reducing LOC. No need to pollute the namespace with temporary throw-away message objects anymore.
test: add parameterized constructor for msg_sendcmpct() #19781
pull theStack wants to merge 1 commits into bitcoin:master from theStack:20200823-test-extend-msg_sendcmpct_ctor changing 2 files +10 −27-
theStack commented at 12:38 AM on August 23, 2020: member
-
test: add parameterized constructor for msg_sendcmpct() 638441928a
- fanquake added the label Tests on Aug 23, 2020
-
practicalswift commented at 5:41 AM on August 23, 2020: contributor
Concept ACK: DRY and -17 LOC :)
-
epson121 commented at 4:46 PM on September 10, 2020: none
Code review ACK 638441928a446726ce3a7fb20433a5478e7585bb
-
guggero commented at 1:50 PM on September 17, 2020: contributor
Code review ACK 638441928a446726ce3a7fb20433a5478e7585bb.
This creates slightly more new
msg_sendcmpctobjects instead of reusing the same one. But in this test context that should not matter at all since it's still a small number of objects. - fanquake requested review from MarcoFalke on Sep 19, 2020
- MarcoFalke merged this on Sep 20, 2020
- MarcoFalke closed this on Sep 20, 2020
- sidhujag referenced this in commit 0753f966dc on Sep 21, 2020
- theStack deleted the branch on Dec 1, 2020
- Fabcien referenced this in commit e13ecc8c66 on Oct 12, 2021
- DrahtBot locked this on Feb 15, 2022