Commit 3dc1fed
committed
peer: Do not send inventory before version
For inbound peers, their version message is read, and the version is marked as
known, before our local peer ever publishes the version message. This could
result in a protocol messaging race where other messages (and in particular,
notifying inventory) may be published prior to our version ever being sent.
While here, remove unused versionSent field from the peer. The new
HandshakeCompleted tracking is strictly better (while it is allowed to send a
peer messages before we have read their version, whether those messages follow
the negotiation protocol version won't be known until after the fact).1 parent 33c9cff commit 3dc1fed
1 file changed
+32
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
| 485 | + | |
485 | 486 | | |
486 | 487 | | |
487 | 488 | | |
488 | | - | |
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
| |||
705 | 705 | | |
706 | 706 | | |
707 | 707 | | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
708 | 720 | | |
709 | 721 | | |
710 | 722 | | |
| |||
1652 | 1664 | | |
1653 | 1665 | | |
1654 | 1666 | | |
1655 | | - | |
| 1667 | + | |
1656 | 1668 | | |
1657 | 1669 | | |
1658 | 1670 | | |
| |||
2080 | 2092 | | |
2081 | 2093 | | |
2082 | 2094 | | |
2083 | | - | |
2084 | | - | |
2085 | | - | |
2086 | 2095 | | |
2087 | 2096 | | |
2088 | 2097 | | |
| |||
2094 | 2103 | | |
2095 | 2104 | | |
2096 | 2105 | | |
2097 | | - | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
2098 | 2115 | | |
2099 | 2116 | | |
2100 | 2117 | | |
| |||
2105 | 2122 | | |
2106 | 2123 | | |
2107 | 2124 | | |
2108 | | - | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
2109 | 2134 | | |
2110 | 2135 | | |
2111 | 2136 | | |
| |||
0 commit comments