88 "fmt"
99 "math/big"
1010
11- "github.com/ChainSafe/chainbridge-core/config/chain"
1211 "github.com/ChainSafe/chainbridge-core/relayer/message"
1312 "github.com/ChainSafe/chainbridge-core/store"
1413 "github.com/rs/zerolog/log"
@@ -27,11 +26,23 @@ type EVMChain struct {
2726 listener EventListener
2827 writer ProposalExecutor
2928 blockstore * store.BlockStore
30- config * chain.EVMConfig
29+
30+ domainID uint8
31+ startBlock * big.Int
32+ freshStart bool
33+ latestBlock bool
3134}
3235
33- func NewEVMChain (listener EventListener , writer ProposalExecutor , blockstore * store.BlockStore , config * chain.EVMConfig ) * EVMChain {
34- return & EVMChain {listener : listener , writer : writer , blockstore : blockstore , config : config }
36+ func NewEVMChain (listener EventListener , writer ProposalExecutor , blockstore * store.BlockStore , domainID uint8 , startBlock * big.Int , latestBlock bool , freshStart bool ) * EVMChain {
37+ return & EVMChain {
38+ listener : listener ,
39+ writer : writer ,
40+ blockstore : blockstore ,
41+ domainID : domainID ,
42+ startBlock : startBlock ,
43+ latestBlock : latestBlock ,
44+ freshStart : freshStart ,
45+ }
3546}
3647
3748// PollEvents is the goroutine that polls blocks and searches Deposit events in them.
@@ -40,10 +51,10 @@ func (c *EVMChain) PollEvents(ctx context.Context, sysErr chan<- error, msgChan
4051 log .Info ().Msg ("Polling Blocks..." )
4152
4253 startBlock , err := c .blockstore .GetStartBlock (
43- * c . config . GeneralChainConfig . Id ,
44- c .config . StartBlock ,
45- c .config . GeneralChainConfig . LatestBlock ,
46- c .config . GeneralChainConfig . FreshStart ,
54+ c . domainID ,
55+ c .startBlock ,
56+ c .latestBlock ,
57+ c .freshStart ,
4758 )
4859 if err != nil {
4960 sysErr <- fmt .Errorf ("error %w on getting last stored block" , err )
@@ -65,5 +76,5 @@ func (c *EVMChain) Write(msg []*message.Message) {
6576}
6677
6778func (c * EVMChain ) DomainID () uint8 {
68- return * c . config . GeneralChainConfig . Id
79+ return c . domainID
6980}
0 commit comments