You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dash-spv: Ledger charges leak on retries without a kick and starve healthy peers #1232
All paths are under dash-spv/src/ at 8dde9d0c (dev after #902).
Every send charges the peer's Ledger for the reply it expects (network/costs.rs:169-181), and only settle refunds it (network/costs.rs:183-223). Broker::requeue (network/broker.rs:124-147) and the attempt 2+ path in Broker::expire (network/broker.rs:204-218) never touch the ledger, so each retry without a kick leaves the old charge on the peer it was taken from. One getcfilters charge (256 KB) is a fresh peer's whole cap, so the router stops picking that peer (network/broker.rs:259), or the frozen-byte check (network/manager.rs:1042-1045) kicks and bans it. Kicks and disconnects are not affected, because the peer's ledger dies with it.
Evidence.
A test with real PeerHandles over loopback sockets that never answer: one retry without a kick leaves B in_flight=262144 cap=262144, and with two leaked peers route reports sent=0 queue=2. A getmnlistdiff (64 KB) fills the cap after four retries.
The testnet benchmark logs show 522 CFilters retries without a kick in one run, and 266 CFilters plus 27 CfHeaders in another. A late reply still settles, so not every retry leaks.
Dash Core v23.1.8 replies with nothing to a failed getmnlistdiff or getqrinfo (net_processing.cpp:5547-5548, :5587-5588, only Misbehaving(1)), to a block it lacks or that is off the main chain (ProcessGetBlockData returns at :2750, :2754, :2778), and to getcfilters while its filter index lags the tip (:3518). These charges are never settled.
GetQRInfo has no RequestKey (network/broker.rs:34-50), so its 1 MB charge (network/costs.rs:25) never expires and the request is never retried by the broker.
A CFilter reply is matched only against the first CFilters entry (network/costs.rs:195-202). A test with batch 1 unanswered and batch 2 answered in full leaves in_flight=457000, while batch 2 alone settles to 0.
Fix. Refund the old peer's charge when the broker requeues a request or it expires, give GetQRInfo a RequestKey, and match a CFilter against every pending CFilters entry by stop hash.
Activity