Commit 36692c9
committed
Get rid of MAX_GETBLOCKTXN_DEPTH constant
Instead of allowing getblocktxn requests for the most recent 10 blocks (and
ignoring requests for other blocks), allow getblocktxn requests for blocks more
recent than the oldest outstanding cmpctblock message.
This fixes a race condition that can happen during tests where more than 10
cmpctblock messages are sent to a peer before the first incoming getblocktxn
messages can be processed, causing sync timeouts when the peer is not to be
able to get in sync.
This is an alternative to the fix in chaincodelabs/ccl-bitcoin@fix-8842-sync-timeouts
Disadvantages of this implementation:
- Requires a new state member.
- Larger code change than the other fix.
Advantages of this implementation:
- Gets rid of the MAX_GETBLOCKTXN_DEPTH constant (which is just arbitrarily set
at twice the value of MAX_CMPCTBLOCK_DEPTH).
- Makes the protocol simpler and more deterministic from the perspective of
receiving peers. Instead of getblocktxn responses yielding either blocktxn or
block messages depending on timing and unrelated internal state of the
sending node, valid getblocktxn requests will reliably trigger blocktxn
responses and no other types of response.
- Unlike the other fix, this doesn't require an update to BIP-152.1 parent e1d1f57 commit 36692c9
3 files changed
+21
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
592 | | - | |
| 592 | + | |
593 | 593 | | |
594 | | - | |
| 594 | + | |
595 | 595 | | |
596 | | - | |
597 | | - | |
| 596 | + | |
| 597 | + | |
598 | 598 | | |
599 | 599 | | |
600 | 600 | | |
| |||
621 | 621 | | |
622 | 622 | | |
623 | 623 | | |
624 | | - | |
| 624 | + | |
625 | 625 | | |
626 | 626 | | |
627 | | - | |
| 627 | + | |
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
| 311 | + | |
311 | 312 | | |
312 | 313 | | |
313 | 314 | | |
| |||
330 | 331 | | |
331 | 332 | | |
332 | 333 | | |
| 334 | + | |
333 | 335 | | |
334 | 336 | | |
335 | 337 | | |
| |||
4922 | 4924 | | |
4923 | 4925 | | |
4924 | 4926 | | |
| 4927 | + | |
| 4928 | + | |
| 4929 | + | |
4925 | 4930 | | |
4926 | 4931 | | |
4927 | 4932 | | |
| |||
5450 | 5455 | | |
5451 | 5456 | | |
5452 | 5457 | | |
5453 | | - | |
5454 | | - | |
| 5458 | + | |
| 5459 | + | |
| 5460 | + | |
| 5461 | + | |
| 5462 | + | |
5455 | 5463 | | |
5456 | 5464 | | |
5457 | 5465 | | |
| |||
5468 | 5476 | | |
5469 | 5477 | | |
5470 | 5478 | | |
| 5479 | + | |
| 5480 | + | |
5471 | 5481 | | |
5472 | 5482 | | |
5473 | 5483 | | |
| |||
6636 | 6646 | | |
6637 | 6647 | | |
6638 | 6648 | | |
| 6649 | + | |
| 6650 | + | |
| 6651 | + | |
6639 | 6652 | | |
6640 | 6653 | | |
6641 | 6654 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
98 | 96 | | |
99 | 97 | | |
100 | 98 | | |
| |||
0 commit comments