fix: PR comments

This commit is contained in:
Raneet Debnath 2022-10-12 09:29:40 +05:30
parent 0218f17bc0
commit fdd7988e94

View file

@ -139,7 +139,7 @@ func TestValidatorWentOffline(t *testing.T) {
// Start the node and wait until it's up // Start the node and wait until it's up
stack, ethBackend, err := initMiner(genesis, keys[i]) stack, ethBackend, err := initMiner(genesis, keys[i])
if err != nil { if err != nil {
panic(err) t.Fatal("Error occured while initialising miner", "error", err)
} }
defer stack.Close() defer stack.Close()
@ -160,7 +160,7 @@ func TestValidatorWentOffline(t *testing.T) {
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
for _, node := range nodes { for _, node := range nodes {
if err := node.StartMining(1); err != nil { if err := node.StartMining(1); err != nil {
panic(err) t.Fatal("Error occured while starting miner", "node", node, "error", err)
} }
} }
@ -198,11 +198,11 @@ func TestValidatorWentOffline(t *testing.T) {
blockHeaderVal1 := nodes[1].BlockChain().GetHeaderByNumber(10) blockHeaderVal1 := nodes[1].BlockChain().GetHeaderByNumber(10)
authorVal0, err := nodes[0].Engine().Author(blockHeaderVal0) authorVal0, err := nodes[0].Engine().Author(blockHeaderVal0)
if err != nil { if err != nil {
log.Error("Error in getting author", "err", err) t.Error("Error in getting author", "err", err)
} }
authorVal1, err := nodes[1].Engine().Author(blockHeaderVal1) authorVal1, err := nodes[1].Engine().Author(blockHeaderVal1)
if err != nil { if err != nil {
log.Error("Error in getting author", "err", err) t.Error("Error in getting author", "err", err)
} }
// check both nodes have the same block 10 // check both nodes have the same block 10
@ -219,11 +219,11 @@ func TestValidatorWentOffline(t *testing.T) {
blockHeaderVal1 = nodes[1].BlockChain().GetHeaderByNumber(11) blockHeaderVal1 = nodes[1].BlockChain().GetHeaderByNumber(11)
authorVal0, err = nodes[0].Engine().Author(blockHeaderVal0) authorVal0, err = nodes[0].Engine().Author(blockHeaderVal0)
if err != nil { if err != nil {
log.Error("Error in getting author", "err", err) t.Error("Error in getting author", "err", err)
} }
authorVal1, err = nodes[1].Engine().Author(blockHeaderVal1) authorVal1, err = nodes[1].Engine().Author(blockHeaderVal1)
if err != nil { if err != nil {
log.Error("Error in getting author", "err", err) t.Error("Error in getting author", "err", err)
} }
// check both nodes have the same block 11 // check both nodes have the same block 11
@ -240,11 +240,11 @@ func TestValidatorWentOffline(t *testing.T) {
blockHeaderVal1 = nodes[1].BlockChain().GetHeaderByNumber(12) blockHeaderVal1 = nodes[1].BlockChain().GetHeaderByNumber(12)
authorVal0, err = nodes[0].Engine().Author(blockHeaderVal0) authorVal0, err = nodes[0].Engine().Author(blockHeaderVal0)
if err != nil { if err != nil {
log.Error("Error in getting author", "err", err) t.Error("Error in getting author", "err", err)
} }
authorVal1, err = nodes[1].Engine().Author(blockHeaderVal1) authorVal1, err = nodes[1].Engine().Author(blockHeaderVal1)
if err != nil { if err != nil {
log.Error("Error in getting author", "err", err) t.Error("Error in getting author", "err", err)
} }
// check both nodes have the same block 12 // check both nodes have the same block 12
@ -261,11 +261,11 @@ func TestValidatorWentOffline(t *testing.T) {
blockHeaderVal1 = nodes[1].BlockChain().GetHeaderByNumber(17) blockHeaderVal1 = nodes[1].BlockChain().GetHeaderByNumber(17)
authorVal0, err = nodes[0].Engine().Author(blockHeaderVal0) authorVal0, err = nodes[0].Engine().Author(blockHeaderVal0)
if err != nil { if err != nil {
log.Error("Error in getting author", "err", err) t.Error("Error in getting author", "err", err)
} }
authorVal1, err = nodes[1].Engine().Author(blockHeaderVal1) authorVal1, err = nodes[1].Engine().Author(blockHeaderVal1)
if err != nil { if err != nil {
log.Error("Error in getting author", "err", err) t.Error("Error in getting author", "err", err)
} }
// check both nodes have the same block 17 // check both nodes have the same block 17
@ -348,7 +348,7 @@ func TestForkWithBlockTime(t *testing.T) {
// Start the node and wait until it's up // Start the node and wait until it's up
stack, ethBackend, err := initMiner(genesis, keys[i]) stack, ethBackend, err := initMiner(genesis, keys[i])
if err != nil { if err != nil {
panic(err) t.Fatal("Error occured while initialising miner", "error", err)
} }
defer stack.Close() defer stack.Close()
@ -369,7 +369,7 @@ func TestForkWithBlockTime(t *testing.T) {
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
for _, node := range nodes { for _, node := range nodes {
if err := node.StartMining(1); err != nil { if err := node.StartMining(1); err != nil {
panic(err) t.Fatal("Error occured while starting miner", "node", node, "error", err)
} }
} }
@ -400,22 +400,22 @@ func TestForkWithBlockTime(t *testing.T) {
author0, err := nodes[0].Engine().Author(blockHeaderVal0) author0, err := nodes[0].Engine().Author(blockHeaderVal0)
if err != nil { if err != nil {
log.Error("Error occured while fetching author", "err", err) t.Error("Error occured while fetching author", "err", err)
} }
author1, err := nodes[1].Engine().Author(blockHeaderVal1) author1, err := nodes[1].Engine().Author(blockHeaderVal1)
if err != nil { if err != nil {
log.Error("Error occured while fetching author", "err", err) t.Error("Error occured while fetching author", "err", err)
} }
assert.Equal(t, author0, author1) assert.Equal(t, author0, author1)
// After the end of sprint // After the end of sprint
author2, err := nodes[0].Engine().Author(blockHeaders[0]) author2, err := nodes[0].Engine().Author(blockHeaders[0])
if err != nil { if err != nil {
log.Error("Error occured while fetching author", "err", err) t.Error("Error occured while fetching author", "err", err)
} }
author3, err := nodes[1].Engine().Author(blockHeaders[1]) author3, err := nodes[1].Engine().Author(blockHeaders[1])
if err != nil { if err != nil {
log.Error("Error occured while fetching author", "err", err) t.Error("Error occured while fetching author", "err", err)
} }
if test.forkExpected { if test.forkExpected {