Skip to content

Commit

Permalink
Merge pull request #105 from lukso-network/feature/l15-prod-resume
Browse files Browse the repository at this point in the history
reorg is off in pandora now
  • Loading branch information
meta-bot authored Oct 31, 2021
2 parents c6c97c1 + 25ed135 commit 1a0bb7c
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions consensus/pandora/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"context"
"fmt"

"github.com/ethereum/go-ethereum/common"

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rlp"
Expand Down Expand Up @@ -201,25 +199,25 @@ func (p *Pandora) processEpochInfo(info *EpochInfoPayload) error {

p.setEpochInfo(epochInfo.Epoch, epochInfo)

if info.ReorgInfo != nil {
log.Info("reorg event received")
// reorg info is present so reorg is triggered in vanguard side
parentHash := common.BytesToHash(info.ReorgInfo.PanParentHash)
parentBlock := p.chain.GetHeaderByHash(parentHash)
if parentBlock != nil {
// it is an invalid behaviour. Pandora doesn't have the block that should be present
parentBlockNumber := parentBlock.Number.Uint64()
err := p.chain.SetHead(parentBlockNumber)
if err != nil {
log.Error("failed to revert to the mentioned block in reorg", "block number", parentBlockNumber, "block hash", parentHash, "error", err)
return err
}
} else {
// requested block is not present. Maybe the node is in previous block and received this Epoch.
// but we can just move on.
log.Info("failed to find block for reorg", "requested hash", parentHash)
}
}
//if info.ReorgInfo != nil {
// log.Info("reorg event received")
// // reorg info is present so reorg is triggered in vanguard side
// parentHash := common.BytesToHash(info.ReorgInfo.PanParentHash)
// parentBlock := p.chain.GetHeaderByHash(parentHash)
// if parentBlock != nil {
// // it is an invalid behaviour. Pandora doesn't have the block that should be present
// parentBlockNumber := parentBlock.Number.Uint64()
// err := p.chain.SetHead(parentBlockNumber)
// if err != nil {
// log.Error("failed to revert to the mentioned block in reorg", "block number", parentBlockNumber, "block hash", parentHash, "error", err)
// return err
// }
// } else {
// // requested block is not present. Maybe the node is in previous block and received this Epoch.
// // but we can just move on.
// log.Info("failed to find block for reorg", "requested hash", parentHash)
// }
//}

return nil
}

0 comments on commit 1a0bb7c

Please sign in to comment.