ethereum-optimism / optimism

Optimism is Ethereum, scaled.
https://optimism.io
MIT License
5.21k stars 2.99k forks source link

add `p2p.sync.onlyreqtostatic` flag to p2p flags #11011

Closed zhiqiangxu closed 2 days ago

zhiqiangxu commented 5 days ago

This PR adds a p2p.sync.onlyreqtostatic flag to op-node so that when enabled, RequestL2Range will only forward requests to static peers.

This is handy for new nodes to increase the success rate for checkForGapInUnsafeQueue, otherwise it often happens that bad peers received the request(peers race to handle the request by receiving from peerRequests channel) and thus report "failed to check for unsafe L2 blocks to sync".

This flag is especially useful for opstack instances with large batcher submit interval(e.g, 12h).

(The big flag diff is caused by goformat, only a new flag SyncOnlyReqToStaticName was added)