Fix random test failures

If block 1 was a null block then blockSet would include genesis which
would lead to us trying to load parent of a genesis block.

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-10-23 19:30:42 +02:00
parent c81db5a21c
commit 16a911bc39
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA
2 changed files with 6 additions and 1 deletions

View File

@ -1396,6 +1396,11 @@ loop:
}
base := blockSet[len(blockSet)-1]
if base.Equals(known) {
blockSet = blockSet[:len(blockSet)-1]
base = blockSet[len(blockSet)-1]
}
if base.IsChildOf(known) {
// common case: receiving blocks that are building on top of our best tipset
return blockSet, nil

View File

@ -280,7 +280,7 @@ minerLoop:
m.minedBlockHeights.Add(blkKey, true)
if err := m.api.SyncSubmitBlock(ctx, b); err != nil {
log.Errorf("failed to submit newly mined block: %s", err)
log.Errorf("failed to submit newly mined block: %+v", err)
}
} else {
base.NullRounds++