Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions gossip/eth_state_adapter.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gossip

import (
"github.com/Fantom-foundation/lachesis-base/inter/idx"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state/snapshot"
Expand All @@ -19,6 +20,12 @@ func newEthBlockChain(s *Store) (*ethBlockChain, error) {
return bc, nil
}

// GenesisBlock returns starting block index.
// Panics if there is no genesis info.
func (bc *ethBlockChain) GenesisBlock() idx.Block {
return *bc.store.GetGenesisBlockIndex()
}

// StateCache returns the caching database underpinning the blockchain instance.
func (bc *ethBlockChain) StateCache() state.Database {
return bc.store.LastKvdbEvmSnapshot().EvmState
Expand Down
3 changes: 3 additions & 0 deletions gossip/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,9 @@ func (h *handler) handleMsg(p *peer) error {
if err := msg.Decode(&progress); err != nil {
return errResp(ErrDecode, "%v: %v", msg, err)
}
if progress.LastBlockIdx > h.chain.GenesisBlock() && progress.Epoch != progress.LastBlockAtropos.Epoch() {
return errResp(ErrNoStatusMsg, "epoch %d does not match atropos %s", progress.Epoch, progress.LastBlockAtropos.String())
}
p.SetProgress(progress)

case msg.Code == EvmTxsMsg:
Expand Down