-
Notifications
You must be signed in to change notification settings - Fork 199
/
pendingMiniBlocksHandlerStub.go
37 lines (31 loc) · 1.13 KB
/
pendingMiniBlocksHandlerStub.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package mock
import (
"github.com/ElrondNetwork/elrond-go/data"
"github.com/ElrondNetwork/elrond-go/data/block"
)
type PendingMiniBlocksHandlerStub struct {
PendingMiniBlockHeadersCalled func(lastNotarizedHeaders []data.HeaderHandler) ([]block.ShardMiniBlockHeader, error)
AddProcessedHeaderCalled func(handler data.HeaderHandler) error
RevertHeaderCalled func(handler data.HeaderHandler) error
}
func (p *PendingMiniBlocksHandlerStub) PendingMiniBlockHeaders(lastNotarizedHeaders []data.HeaderHandler) ([]block.ShardMiniBlockHeader, error) {
if p.PendingMiniBlockHeadersCalled != nil {
return p.PendingMiniBlockHeadersCalled(lastNotarizedHeaders)
}
return nil, nil
}
func (p *PendingMiniBlocksHandlerStub) AddProcessedHeader(handler data.HeaderHandler) error {
if p.AddProcessedHeaderCalled != nil {
return p.AddProcessedHeaderCalled(handler)
}
return nil
}
func (p *PendingMiniBlocksHandlerStub) RevertHeader(handler data.HeaderHandler) error {
if p.RevertHeaderCalled != nil {
return p.RevertHeaderCalled(handler)
}
return nil
}
func (p *PendingMiniBlocksHandlerStub) IsInterfaceNil() bool {
return p == nil
}