@@ -11,14 +11,15 @@ import (
1111 proto_sentry "github.com/ledgerwatch/erigon-lib/gointerfaces/sentry"
1212 "github.com/ledgerwatch/erigon-lib/kv"
1313 "github.com/ledgerwatch/erigon-lib/kv/memdb"
14+ "github.com/stretchr/testify/require"
15+
1416 "github.com/ledgerwatch/erigon/common"
1517 "github.com/ledgerwatch/erigon/core"
1618 "github.com/ledgerwatch/erigon/core/forkid"
1719 "github.com/ledgerwatch/erigon/core/rawdb"
1820 "github.com/ledgerwatch/erigon/eth/protocols/eth"
1921 "github.com/ledgerwatch/erigon/p2p"
2022 "github.com/ledgerwatch/erigon/params"
21- "github.com/stretchr/testify/require"
2223)
2324
2425func testSentryServer (db kv.Getter , genesis * core.Genesis , genesisHash common.Hash ) * GrpcServer {
@@ -34,14 +35,17 @@ func testSentryServer(db kv.Getter, genesis *core.Genesis, genesisHash common.Ha
3435
3536 headTd256 := new (uint256.Int )
3637 headTd256 .SetFromBig (headTd )
38+ heightForks , timeForks := forkid .GatherForks (genesis .Config )
3739 s .statusData = & proto_sentry.StatusData {
3840 NetworkId : 1 ,
3941 TotalDifficulty : gointerfaces .ConvertUint256IntToH256 (headTd256 ),
4042 BestHash : gointerfaces .ConvertHashToH256 (head .Hash ()),
41- MaxBlock : head .Number .Uint64 (),
43+ MaxBlockHeight : head .Number .Uint64 (),
44+ MaxBlockTime : head .Time ,
4245 ForkData : & proto_sentry.Forks {
43- Genesis : gointerfaces .ConvertHashToH256 (genesisHash ),
44- Forks : forkid .GatherForks (genesis .Config ),
46+ Genesis : gointerfaces .ConvertHashToH256 (genesisHash ),
47+ HeightForks : heightForks ,
48+ TimeForks : timeForks ,
4549 },
4650 }
4751 return s
@@ -107,8 +111,8 @@ func testForkIDSplit(t *testing.T, protocol uint) {
107111 }
108112
109113 // Progress into Homestead. Fork's match, so we don't care what the future holds
110- s1 .statusData .MaxBlock = 1
111- s2 .statusData .MaxBlock = 1
114+ s1 .statusData .MaxBlockHeight = 1
115+ s2 .statusData .MaxBlockHeight = 1
112116
113117 go func () { errc <- handShake (ctx , s1 .GetStatus (), [64 ]byte {1 }, p2pNoFork , protocol , protocol , nil ) }()
114118 go func () { errc <- handShake (ctx , s2 .GetStatus (), [64 ]byte {2 }, p2pProFork , protocol , protocol , nil ) }()
@@ -125,8 +129,8 @@ func testForkIDSplit(t *testing.T, protocol uint) {
125129 }
126130
127131 // Progress into Spurious. Forks mismatch, signalling differing chains, reject
128- s1 .statusData .MaxBlock = 2
129- s2 .statusData .MaxBlock = 2
132+ s1 .statusData .MaxBlockHeight = 2
133+ s2 .statusData .MaxBlockHeight = 2
130134
131135 // Both nodes should allow the other to connect (same genesis, next fork is the same)
132136 go func () { errc <- handShake (ctx , s1 .GetStatus (), [64 ]byte {1 }, p2pNoFork , protocol , protocol , nil ) }()
0 commit comments