Compact-filter sync currently has code paths that ban peers when they fail to answer a follow-up query, even though the code has not proved that they served invalid data. The implementation is conflating "peer sent bad compact-filter data" with "peer did not respond / disconnected / local node was offline during the follow-up exchange".
This matters because a ban is a strong classification. A peer that times out or disappears during a follow-up compact-filter query may be experiencing an ordinary network failure, or the local node may be offline, but the code can still treat that as misbehavior.
There are two concrete places where this happens. In resolveConflict, peers that do not appear in the follow-up cfheaders response map are banned with InvalidFilterHeaderCheckpoint. In detectBadPeers, a peer that does not answer the follow-up cfilter request is marked bad and then banned with InvalidFilterHeader during checkpoint conflict handling and during uncheckpointed filter-header mismatch handling.
The shared queryAllPeers helper only works with a snapshot of currently connected peers and waits for replies, while its callers only add cfheaders responders to the result map, only add cfilter responders to the result map, and only add checkpoint responders to the result map. A timeout, disconnect, or other network failure therefore just means the peer is missing from the result map, and higher layers then interpret that absence as evidence of bad data in the paths above.
Expected behavior is to distinguish between "peer responded with data that can be verified as invalid" and "peer did not respond / request could not be completed". Only the first case should lead to InvalidFilterHeader or InvalidFilterHeaderCheckpoint. The second case may justify retrying, deprioritizing, or disconnecting, but not banning.
This can cause honest IPv4/IPv6 peers to be banned for 24 hours (the BanDuration constant in neutrino.go) during periods where the local node is offline or connectivity is unstable. PR #348 teaches banman to also recognize onion peers (Tor V3). Currently onion peers are not banned at all.
See also #4 and #253
Compact-filter sync currently has code paths that ban peers when they fail to answer a follow-up query, even though the code has not proved that they served invalid data. The implementation is conflating "peer sent bad compact-filter data" with "peer did not respond / disconnected / local node was offline during the follow-up exchange".
This matters because a ban is a strong classification. A peer that times out or disappears during a follow-up compact-filter query may be experiencing an ordinary network failure, or the local node may be offline, but the code can still treat that as misbehavior.
There are two concrete places where this happens. In resolveConflict, peers that do not appear in the follow-up cfheaders response map are banned with InvalidFilterHeaderCheckpoint. In detectBadPeers, a peer that does not answer the follow-up cfilter request is marked bad and then banned with InvalidFilterHeader during checkpoint conflict handling and during uncheckpointed filter-header mismatch handling.
The shared queryAllPeers helper only works with a snapshot of currently connected peers and waits for replies, while its callers only add cfheaders responders to the result map, only add cfilter responders to the result map, and only add checkpoint responders to the result map. A timeout, disconnect, or other network failure therefore just means the peer is missing from the result map, and higher layers then interpret that absence as evidence of bad data in the paths above.
Expected behavior is to distinguish between "peer responded with data that can be verified as invalid" and "peer did not respond / request could not be completed". Only the first case should lead to
InvalidFilterHeaderorInvalidFilterHeaderCheckpoint. The second case may justify retrying, deprioritizing, or disconnecting, but not banning.This can cause honest IPv4/IPv6 peers to be banned for 24 hours (the
BanDurationconstant inneutrino.go) during periods where the local node is offline or connectivity is unstable. PR #348 teaches banman to also recognize onion peers (Tor V3). Currently onion peers are not banned at all.See also #4 and #253