btcd/netsync
Oli a7e980dd34
netsync: require block-serving services on regtest/simnet sync peers
Commit 26124d275 made every peer a sync candidate on regtest and
simnet so that nodes on non-localhost networks (e.g. Docker bridge
networks) can be synced from. Dropping the address requirement was
the intent, but the change also dropped the service-flag requirement,
so light clients became eligible sync peers.

A light client (e.g. neutrino) advertises a recent best height but
can serve neither headers nor blocks. Electing one as the sync peer
stalls the sync until the stall handler disconnects it, and with
other light client connections present the next one is elected and
stalls again, livelocking the sync indefinitely. This surfaced in
neutrino's sync tests, where a btcd simnet node connected to both a
neutrino instance and other btcd nodes never synced.

Keep accepting any peer address on regtest/simnet, but require the
peer to signal SFNodeNetwork or SFNodeNetworkLimited like on any
other network.
2026-06-17 13:45:43 +02:00
..
testdata netsync: add checkHeadersList 2026-02-26 16:33:47 +09:00
blocklogger.go multi: use new v2 modules everywhere 2026-05-14 18:05:33 -07:00
doc.go netsync: Change name of blockManager to syncManager. 2017-08-25 13:41:22 -05:00
interface.go multi: use new v2 modules everywhere 2026-05-14 18:05:33 -07:00
log.go netsync: Use package-local logger. 2017-08-25 13:41:22 -05:00
manager.go netsync: require block-serving services on regtest/simnet sync peers 2026-06-17 13:45:43 +02:00
manager_test.go netsync: require block-serving services on regtest/simnet sync peers 2026-06-17 13:45:43 +02:00
README.md docs: update shields 2021-03-05 07:45:19 -05:00

netsync

Build Status ISC License GoDoc

Overview

This package implements a concurrency safe block syncing protocol. The SyncManager communicates with connected peers to perform an initial block download, keep the chain and unconfirmed transaction pool in sync, and announce new blocks connected to the chain. Currently the sync manager selects a single sync peer that it downloads all blocks from until it is up to date with the longest chain the sync peer is aware of.

Installation and Updating

$ go get -u github.com/btcsuite/btcd/netsync

License

Package netsync is licensed under the copyfree ISC License.