@@ -8,21 +8,23 @@ import (
88
99// ForkDetectorStub is a mock implementation for the ForkDetector interface
1010type ForkDetectorStub struct {
11- AddHeaderCalled func (header data.HeaderHandler , hash []byte , state process.BlockHeaderState , selfNotarizedHeaders []data.HeaderHandler , selfNotarizedHeadersHashes [][]byte ) error
12- RemoveHeaderCalled func (nonce uint64 , hash []byte )
13- RemoveCommittedHeaderCalled func (nonce uint64 , hash []byte )
14- CheckForkCalled func () * process.ForkInfo
15- GetHighestFinalBlockNonceCalled func () uint64
16- GetHighestFinalBlockHashCalled func () []byte
17- ProbableHighestNonceCalled func () uint64
18- ResetForkCalled func ()
19- GetNotarizedHeaderHashCalled func (nonce uint64 ) []byte
20- RestoreToGenesisCalled func ()
21- SetRollBackNonceCalled func (nonce uint64 )
22- ResetProbableHighestNonceCalled func ()
23- SetFinalToLastCheckpointCalled func ()
24- ReceivedProofCalled func (proof data.HeaderProofHandler )
25- AddCheckpointCalled func (nonce uint64 , round uint64 , hash []byte )
11+ AddHeaderCalled func (header data.HeaderHandler , hash []byte , state process.BlockHeaderState , selfNotarizedHeaders []data.HeaderHandler , selfNotarizedHeadersHashes [][]byte ) error
12+ RemoveHeaderCalled func (nonce uint64 , hash []byte )
13+ RemoveCommittedHeaderCalled func (nonce uint64 , hash []byte )
14+ ReconcileFinalCheckpointCalled func (nonce uint64 )
15+ CheckForkCalled func () * process.ForkInfo
16+ GetHighestFinalBlockNonceCalled func () uint64
17+ GetHighestFinalBlockHashCalled func () []byte
18+ GetHighestSettledBlockInfoCalled func () (uint64 , []byte )
19+ ProbableHighestNonceCalled func () uint64
20+ ResetForkCalled func ()
21+ GetNotarizedHeaderHashCalled func (nonce uint64 ) []byte
22+ RestoreToGenesisCalled func ()
23+ SetRollBackNonceCalled func (nonce uint64 )
24+ ResetProbableHighestNonceCalled func ()
25+ SetFinalToLastCheckpointCalled func ()
26+ ReceivedProofCalled func (proof data.HeaderProofHandler )
27+ AddCheckpointCalled func (nonce uint64 , round uint64 , hash []byte )
2628}
2729
2830// RestoreToGenesis -
@@ -60,6 +62,13 @@ func (fdm *ForkDetectorStub) RemoveCommittedHeader(nonce uint64, hash []byte) {
6062 }
6163}
6264
65+ // ReconcileFinalCheckpoint -
66+ func (fdm * ForkDetectorStub ) ReconcileFinalCheckpoint (nonce uint64 ) {
67+ if fdm .ReconcileFinalCheckpointCalled != nil {
68+ fdm .ReconcileFinalCheckpointCalled (nonce )
69+ }
70+ }
71+
6372// CheckFork is a mock implementation for CheckFork
6473func (fdm * ForkDetectorStub ) CheckFork () * process.ForkInfo {
6574 if fdm .CheckForkCalled != nil {
@@ -81,6 +90,23 @@ func (fdm *ForkDetectorStub) GetHighestFinalBlockHash() []byte {
8190 return fdm .GetHighestFinalBlockHashCalled ()
8291}
8392
93+ // GetHighestSettledBlockInfo -
94+ func (fdm * ForkDetectorStub ) GetHighestSettledBlockInfo () (uint64 , []byte ) {
95+ if fdm .GetHighestSettledBlockInfoCalled != nil {
96+ return fdm .GetHighestSettledBlockInfoCalled ()
97+ }
98+
99+ nonce := uint64 (0 )
100+ if fdm .GetHighestFinalBlockNonceCalled != nil {
101+ nonce = fdm .GetHighestFinalBlockNonceCalled ()
102+ }
103+ var hash []byte
104+ if fdm .GetHighestFinalBlockHashCalled != nil {
105+ hash = fdm .GetHighestFinalBlockHashCalled ()
106+ }
107+ return nonce , hash
108+ }
109+
84110// ProbableHighestNonce is a mock implementation for ProbableHighestNonce
85111func (fdm * ForkDetectorStub ) ProbableHighestNonce () uint64 {
86112 if fdm .ProbableHighestNonceCalled != nil {
0 commit comments