Commit 9f66ac7
committed
net_processing: do not treat non-connecting headers as response
Since bitcoin#25454 we keep track of the last
GETHEADERS request that was sent and wasn't responded to. So far, every incoming
HEADERS message is treated as a response to whatever GETHEADERS was last sent,
regardless of its contents.
This commit makes this tracking more accurate, by only treating HEADERS messages
which (1) are empty, (2) connect to our existing block header tree, or (3) are a
continuation of a low-work headers sync as responses that clear the "outstanding
GETHEADERS" state (m_last_getheaders_timestamp).
That means that HEADERS messages which do not satisfy any of the above criteria
will be ignored, not triggering a GETHEADERS, and potentially (for now, but see
later commit) increase misbehavior score.1 parent 0a7c650 commit 9f66ac7
2 files changed
+24
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2768 | 2768 | | |
2769 | 2769 | | |
2770 | 2770 | | |
| 2771 | + | |
| 2772 | + | |
2771 | 2773 | | |
2772 | 2774 | | |
2773 | 2775 | | |
2774 | 2776 | | |
| 2777 | + | |
| 2778 | + | |
2775 | 2779 | | |
2776 | 2780 | | |
2777 | | - | |
2778 | | - | |
2779 | | - | |
2780 | | - | |
2781 | | - | |
| 2781 | + | |
2782 | 2782 | | |
2783 | | - | |
2784 | | - | |
2785 | | - | |
2786 | | - | |
2787 | | - | |
2788 | | - | |
2789 | | - | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
2790 | 2786 | | |
2791 | 2787 | | |
2792 | 2788 | | |
| |||
3065 | 3061 | | |
3066 | 3062 | | |
3067 | 3063 | | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
3068 | 3067 | | |
3069 | 3068 | | |
3070 | 3069 | | |
| |||
3129 | 3128 | | |
3130 | 3129 | | |
3131 | 3130 | | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
3132 | 3136 | | |
3133 | 3137 | | |
3134 | 3138 | | |
| |||
4984 | 4988 | | |
4985 | 4989 | | |
4986 | 4990 | | |
4987 | | - | |
4988 | | - | |
4989 | | - | |
4990 | | - | |
4991 | 4991 | | |
4992 | 4992 | | |
4993 | 4993 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
562 | | - | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
563 | 569 | | |
564 | 570 | | |
565 | 571 | | |
| |||
574 | 580 | | |
575 | 581 | | |
576 | 582 | | |
| 583 | + | |
577 | 584 | | |
578 | 585 | | |
579 | 586 | | |
| |||
0 commit comments