stacks-network / stacks-core

The Stacks blockchain implementation
https://docs.stacks.co
GNU General Public License v3.0
3.01k stars 671 forks source link

[Network] awaken Nakamoto inv sync / block download if the p2p state machine sees unprocessable staging blocks #5144

Open jcnelson opened 2 months ago

jcnelson commented 2 months ago

The presence of unprocessable (e.g. discontinuous) staging blocks in the Nakamoto staging blocks DB is a strong hint that the node has missed a Nakamoto block push, and should immediately attempt an inventory sync and block download with its neighbors.

This is bursty behavior that can be easily weaponized by a rogue miner, so care will need to be taken to ensure that the node only exhibits this bursty behavior for a short window of time (e.g. burst for N seconds per newly-observed unprocessable block).