-
Notifications
You must be signed in to change notification settings - Fork 202
/
blockSizeComputationStub.go
52 lines (45 loc) · 1.49 KB
/
blockSizeComputationStub.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package testscommon
// BlockSizeComputationStub -
type BlockSizeComputationStub struct {
InitCalled func()
AddNumMiniBlocksCalled func(int)
AddNumTxsCalled func(int)
IsMaxBlockSizeReachedCalled func(int, int) bool
IsMaxBlockSizeWithoutThrottleReachedCalled func(int, int) bool
}
// Init -
func (bscs *BlockSizeComputationStub) Init() {
if bscs.InitCalled != nil {
bscs.InitCalled()
}
}
// AddNumMiniBlocks -
func (bscs *BlockSizeComputationStub) AddNumMiniBlocks(numMiniBlocks int) {
if bscs.AddNumMiniBlocksCalled != nil {
bscs.AddNumMiniBlocksCalled(numMiniBlocks)
}
}
// AddNumTxs -
func (bscs *BlockSizeComputationStub) AddNumTxs(numTxs int) {
if bscs.AddNumTxsCalled != nil {
bscs.AddNumTxsCalled(numTxs)
}
}
// IsMaxBlockSizeWithoutThrottleReached -
func (bscs *BlockSizeComputationStub) IsMaxBlockSizeWithoutThrottleReached(numNewMiniBlocks int, numNewTxs int) bool {
if bscs.IsMaxBlockSizeWithoutThrottleReachedCalled != nil {
return bscs.IsMaxBlockSizeWithoutThrottleReachedCalled(numNewMiniBlocks, numNewTxs)
}
return false
}
// IsMaxBlockSizeReached -
func (bscs *BlockSizeComputationStub) IsMaxBlockSizeReached(numNewMiniBlocks int, numNewTxs int) bool {
if bscs.IsMaxBlockSizeReachedCalled != nil {
return bscs.IsMaxBlockSizeReachedCalled(numNewMiniBlocks, numNewTxs)
}
return false
}
// IsInterfaceNil -
func (bscs *BlockSizeComputationStub) IsInterfaceNil() bool {
return bscs == nil
}