Skip to content

Commit a855c3d

Browse files
authored
Merge pull request #402 from SiaFoundation/chris/not-on-best-chain-fix
fix sending genesis blocks to peers in syncLoop
2 parents 16ee015 + cc206a4 commit a855c3d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
default: patch
3+
---
4+
5+
# Fix edge case where a node incorrectly sends the genesis state to peers while syncing.

syncer/syncer.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,11 @@ func (s *Syncer) syncLoop(ctx context.Context) error {
680680
go func(p *Peer) {
681681
cs, headers, remaining, err := func() (consensus.State, []types.BlockHeader, uint64, error) {
682682
for _, id := range hist {
683+
if id == (types.BlockID{}) {
684+
// skip empty history entries which can occur when
685+
// we don't have a full history of blocks.
686+
continue
687+
}
683688
cs, ok := s.cm.State(id)
684689
if !ok {
685690
return consensus.State{}, nil, 0, errors.New("missing state for history")

0 commit comments

Comments
 (0)