Version 2 of BIP152 high-bandwidth mode/compact blocks implements SegWit support.
As Dash does not implement SegWit, there has never been a need to implement v2 (and therefore, have all the code necessary to support both v1 and v2, that gets removed as part of making support v2 only).
Despite that, the changes surrounding removing support for both versions (that in our case, do not apply as we never have supported v2) refactor the code in other ways and influence their behaviour. In the interest of upstream alignment, those changes have been backported.
bitcoin#19776 doesn't seem to work on its own without successive backports, specifically bitcoin#20799, despite the latter being a later backport.
19776-only p2p_compactblocks.py run (9f2c868947cc254d021e1a9bd00eb7bc80061e81)
```
dash@825a14c32b73:/src/dash$ ./test/functional/p2p_compactblocks.py
2024-06-09T12:29:09.777000Z TestFramework (INFO): Initializing test directory /tmp/dash_func_test_kb2nr5oe
2024-06-09T12:29:16.341000Z TestFramework (INFO): Testing SENDCMPCT p2p message...
2024-06-09T12:29:31.432000Z TestFramework (INFO): Testing compactblock construction...
2024-06-09T12:29:40.068000Z TestFramework (INFO): Testing compactblock requests...
2024-06-09T12:29:44.597000Z TestFramework (INFO): Testing getblocktxn handler...
2024-06-09T12:29:59.808000Z TestFramework (INFO): Testing compactblock requests/announcements not at chain tip...
2024-06-09T12:30:03.855000Z TestFramework (INFO): Testing handling of incorrect blocktxn responses...
2024-06-09T12:30:05.868000Z TestFramework (INFO): Testing reconstructing compact blocks from all peers...
2024-06-09T12:30:09.389000Z TestFramework (INFO): Testing end-to-end block relay...
2024-06-09T12:30:10.404000Z TestFramework (INFO): Testing handling of invalid compact blocks...
2024-06-09T12:30:12.418000Z TestFramework (INFO): Testing invalid index in cmpctblock message...
2024-06-09T12:30:14.384000Z TestFramework (INFO): Testing high-bandwidth mode states via getpeerinfo...
2024-06-09T12:30:16.893000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
File "/src/dash/test/functional/test_framework/test_framework.py", line 158, in main
self.run_test()
File "./test/functional/p2p_compactblocks.py", line 849, in run_test
self.test_highbandwidth_mode_states_via_getpeerinfo()
File "./test/functional/p2p_compactblocks.py", line 791, in test_highbandwidth_mode_states_via_getpeerinfo
hb_test_node.send_and_ping(msg_block(block))
File "/src/dash/test/functional/test_framework/p2p.py", line 579, in send_and_ping
self.sync_with_ping(timeout=timeout)
File "/src/dash/test/functional/test_framework/p2p.py", line 596, in sync_with_ping
self.wait_until(test_function, timeout=timeout)
File "/src/dash/test/functional/test_framework/p2p.py", line 487, in wait_until
wait_until_helper(test_function, timeout=timeout, lock=p2p_lock, timeout_factor=self.timeout_factor)
File "/src/dash/test/functional/test_framework/util.py", line 249, in wait_until_helper
if predicate():
File "/src/dash/test/functional/test_framework/p2p.py", line 484, in test_function
assert self.is_connected
AssertionError
2024-06-09T12:30:17.396000Z TestFramework (INFO): Stopping nodes
2024-06-09T12:30:18.400000Z TestFramework (WARNING): Not cleaning up dir /tmp/dash_func_test_kb2nr5oe
2024-06-09T12:30:18.401000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/dash_func_test_kb2nr5oe/test_framework.log
2024-06-09T12:30:18.401000Z TestFramework (ERROR):
2024-06-09T12:30:18.401000Z TestFramework (ERROR): Hint: Call /src/dash/test/functional/combine_logs.py '/tmp/dash_func_test_kb2nr5oe' to consolidate all logs
2024-06-09T12:30:18.401000Z TestFramework (ERROR):
2024-06-09T12:30:18.401000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2024-06-09T12:30:18.402000Z TestFramework (ERROR): https://github.com/dashpay/dash/issues
2024-06-09T12:30:18.402000Z TestFramework (ERROR):
```
20799-incl p2p_compactblocks.py run (aa116c4f0b4753b615f9483aa03adec5ee4fd655)
```
dash@825a14c32b73:/src/dash$ ./test/functional/p2p_compactblocks.py
2024-06-09T12:34:27.169000Z TestFramework (INFO): Initializing test directory /tmp/dash_func_test_7d65lmhz
2024-06-09T12:34:32.695000Z TestFramework (INFO): Testing SENDCMPCT p2p message...
2024-06-09T12:34:51.288000Z TestFramework (INFO): Testing compactblock construction...
2024-06-09T12:34:55.325000Z TestFramework (INFO): Testing compactblock requests...
2024-06-09T12:34:59.861000Z TestFramework (INFO): Testing getblocktxn handler...
2024-06-09T12:35:07.460000Z TestFramework (INFO): Testing compactblock requests/announcements not at chain tip...
2024-06-09T12:35:09.503000Z TestFramework (INFO): Testing handling of incorrect blocktxn responses...
2024-06-09T12:35:11.519000Z TestFramework (INFO): Testing reconstructing compact blocks from all peers...
2024-06-09T12:35:15.039000Z TestFramework (INFO): Testing end-to-end block relay...
2024-06-09T12:35:16.055000Z TestFramework (INFO): Testing handling of invalid compact blocks...
2024-06-09T12:35:17.062000Z TestFramework (INFO): Testing invalid index in cmpctblock message...
2024-06-09T12:35:19.139000Z TestFramework (INFO): Testing high-bandwidth mode states via getpeerinfo...
2024-06-09T12:35:22.159000Z TestFramework (INFO): Stopping nodes
2024-06-09T12:35:23.163000Z TestFramework (INFO): Cleaning up /tmp/dash_func_test_7d65lmhz on exit
2024-06-09T12:35:23.163000Z TestFramework (INFO): Tests successful
```
The backport of bitcoin#20764 is a continuation of bd934c71eb232c2787593bf4766aa92ce5743ae3 from dash#6034
Breaking changes
The getpeerinfo RPC returns two new boolean fields, bip152_hb_to and bip152_hb_from, that respectively indicate whether we selected a peer to be in compact blocks high-bandwidth mode or whether a peer selected us as a compact blocks high-bandwidth peer.
High-bandwidth peers send new block announcements via a cmpctblock message rather than the usual inv/headers announcements. See BIP 152 for more details.
Blocks-only mode will use legacy relaying instead of BIP152 high-bandwidth mode
Checklist:
[x] I have performed a self-review of my own code
[x] I have commented my code, particularly in hard-to-understand areas (note: N/A)
[x] I have added or updated relevant unit/integration/functional/e2e tests
[x] I have made corresponding changes to the documentation
[x] I have assigned this pull request to a milestone (for repository code-owners and collaborators only)
Additional Information
Version 2 of BIP152 high-bandwidth mode/compact blocks implements SegWit support.
As Dash does not implement SegWit, there has never been a need to implement v2 (and therefore, have all the code necessary to support both v1 and v2, that gets removed as part of making support v2 only).
bitcoin#19776 doesn't seem to work on its own without successive backports, specifically bitcoin#20799, despite the latter being a later backport.
19776-only p2p_compactblocks.py run (9f2c868947cc254d021e1a9bd00eb7bc80061e81)
``` dash@825a14c32b73:/src/dash$ ./test/functional/p2p_compactblocks.py 2024-06-09T12:29:09.777000Z TestFramework (INFO): Initializing test directory /tmp/dash_func_test_kb2nr5oe 2024-06-09T12:29:16.341000Z TestFramework (INFO): Testing SENDCMPCT p2p message... 2024-06-09T12:29:31.432000Z TestFramework (INFO): Testing compactblock construction... 2024-06-09T12:29:40.068000Z TestFramework (INFO): Testing compactblock requests... 2024-06-09T12:29:44.597000Z TestFramework (INFO): Testing getblocktxn handler... 2024-06-09T12:29:59.808000Z TestFramework (INFO): Testing compactblock requests/announcements not at chain tip... 2024-06-09T12:30:03.855000Z TestFramework (INFO): Testing handling of incorrect blocktxn responses... 2024-06-09T12:30:05.868000Z TestFramework (INFO): Testing reconstructing compact blocks from all peers... 2024-06-09T12:30:09.389000Z TestFramework (INFO): Testing end-to-end block relay... 2024-06-09T12:30:10.404000Z TestFramework (INFO): Testing handling of invalid compact blocks... 2024-06-09T12:30:12.418000Z TestFramework (INFO): Testing invalid index in cmpctblock message... 2024-06-09T12:30:14.384000Z TestFramework (INFO): Testing high-bandwidth mode states via getpeerinfo... 2024-06-09T12:30:16.893000Z TestFramework (ERROR): Assertion failed Traceback (most recent call last): File "/src/dash/test/functional/test_framework/test_framework.py", line 158, in main self.run_test() File "./test/functional/p2p_compactblocks.py", line 849, in run_test self.test_highbandwidth_mode_states_via_getpeerinfo() File "./test/functional/p2p_compactblocks.py", line 791, in test_highbandwidth_mode_states_via_getpeerinfo hb_test_node.send_and_ping(msg_block(block)) File "/src/dash/test/functional/test_framework/p2p.py", line 579, in send_and_ping self.sync_with_ping(timeout=timeout) File "/src/dash/test/functional/test_framework/p2p.py", line 596, in sync_with_ping self.wait_until(test_function, timeout=timeout) File "/src/dash/test/functional/test_framework/p2p.py", line 487, in wait_until wait_until_helper(test_function, timeout=timeout, lock=p2p_lock, timeout_factor=self.timeout_factor) File "/src/dash/test/functional/test_framework/util.py", line 249, in wait_until_helper if predicate(): File "/src/dash/test/functional/test_framework/p2p.py", line 484, in test_function assert self.is_connected AssertionError 2024-06-09T12:30:17.396000Z TestFramework (INFO): Stopping nodes 2024-06-09T12:30:18.400000Z TestFramework (WARNING): Not cleaning up dir /tmp/dash_func_test_kb2nr5oe 2024-06-09T12:30:18.401000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/dash_func_test_kb2nr5oe/test_framework.log 2024-06-09T12:30:18.401000Z TestFramework (ERROR): 2024-06-09T12:30:18.401000Z TestFramework (ERROR): Hint: Call /src/dash/test/functional/combine_logs.py '/tmp/dash_func_test_kb2nr5oe' to consolidate all logs 2024-06-09T12:30:18.401000Z TestFramework (ERROR): 2024-06-09T12:30:18.401000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log. 2024-06-09T12:30:18.402000Z TestFramework (ERROR): https://github.com/dashpay/dash/issues 2024-06-09T12:30:18.402000Z TestFramework (ERROR): ```20799-incl p2p_compactblocks.py run (aa116c4f0b4753b615f9483aa03adec5ee4fd655)
``` dash@825a14c32b73:/src/dash$ ./test/functional/p2p_compactblocks.py 2024-06-09T12:34:27.169000Z TestFramework (INFO): Initializing test directory /tmp/dash_func_test_7d65lmhz 2024-06-09T12:34:32.695000Z TestFramework (INFO): Testing SENDCMPCT p2p message... 2024-06-09T12:34:51.288000Z TestFramework (INFO): Testing compactblock construction... 2024-06-09T12:34:55.325000Z TestFramework (INFO): Testing compactblock requests... 2024-06-09T12:34:59.861000Z TestFramework (INFO): Testing getblocktxn handler... 2024-06-09T12:35:07.460000Z TestFramework (INFO): Testing compactblock requests/announcements not at chain tip... 2024-06-09T12:35:09.503000Z TestFramework (INFO): Testing handling of incorrect blocktxn responses... 2024-06-09T12:35:11.519000Z TestFramework (INFO): Testing reconstructing compact blocks from all peers... 2024-06-09T12:35:15.039000Z TestFramework (INFO): Testing end-to-end block relay... 2024-06-09T12:35:16.055000Z TestFramework (INFO): Testing handling of invalid compact blocks... 2024-06-09T12:35:17.062000Z TestFramework (INFO): Testing invalid index in cmpctblock message... 2024-06-09T12:35:19.139000Z TestFramework (INFO): Testing high-bandwidth mode states via getpeerinfo... 2024-06-09T12:35:22.159000Z TestFramework (INFO): Stopping nodes 2024-06-09T12:35:23.163000Z TestFramework (INFO): Cleaning up /tmp/dash_func_test_7d65lmhz on exit 2024-06-09T12:35:23.163000Z TestFramework (INFO): Tests successful ```The backport of bitcoin-core/gui#206 is a continuation of 3e8ba24c87e32c2669c7be6924e750e29805a30e from dash#5964
The backport of bitcoin#20764 is a continuation of bd934c71eb232c2787593bf4766aa92ce5743ae3 from dash#6034
Breaking changes
The
getpeerinfo
RPC returns two new boolean fields,bip152_hb_to
andbip152_hb_from
, that respectively indicate whether we selected a peer to be in compact blocks high-bandwidth mode or whether a peer selected us as a compact blocks high-bandwidth peer.High-bandwidth peers send new block announcements via a
cmpctblock
message rather than the usual inv/headers announcements. See BIP 152 for more details.Blocks-only mode will use legacy relaying instead of BIP152 high-bandwidth mode
Checklist: