@@ -351,9 +351,14 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, cfg X
351351 started := false
352352 ok := false
353353 var err error
354- ok , err = ethBackend .ValidateMasternode ()
355- if err != nil {
356- utils .Fatalf ("Can't verify masternode permission: %v" , err )
354+ // Skip masternode validation while syncing: IsAuthorisedAddress would
355+ // query a snapshot for an unsynced head (failing/noisy and pointlessly
356+ // expensive). Staking is (re)evaluated on the first checkpoint after sync.
357+ if ! ethBackend .Downloader ().Synchronising () {
358+ ok , err = ethBackend .ValidateMasternode ()
359+ if err != nil {
360+ utils .Fatalf ("Can't verify masternode permission: %v" , err )
361+ }
357362 }
358363 if ok {
359364 log .Info ("Masternode found. Enabling staking mode..." )
@@ -379,10 +384,19 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, cfg X
379384 chain := ethBackend .BlockChain ()
380385 engine .UpdateParams (chain .CurrentHeader ())
381386
382- ok , err = ethBackend .ValidateMasternode ()
383- if err != nil {
384- utils .Fatalf ("Can't verify masternode permission: %v" , err )
387+ ok = false
388+ // While syncing, skip masternode validation (IsAuthorisedAddress ->
389+ // GetSnapshot on the just-imported head). The CheckpointCh send in
390+ // insertChain/insertBlock is unbuffered, so we still receive here to
391+ // avoid blocking block import; staking resumes on the first checkpoint
392+ // after sync completes.
393+ if ! ethBackend .Downloader ().Synchronising () {
394+ ok , err = ethBackend .ValidateMasternode ()
395+ if err != nil {
396+ utils .Fatalf ("Can't verify masternode permission: %v" , err )
397+ }
385398 }
399+
386400 if ! ok {
387401 if started {
388402 log .Info ("Only masternode can propose and verify blocks. Cancelling staking on this node..." )
0 commit comments