-
Notifications
You must be signed in to change notification settings - Fork 199
/
miniBlocksProviderStub.go
41 lines (35 loc) · 1.3 KB
/
miniBlocksProviderStub.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
package mock
import (
"github.com/multiversx/mx-chain-core-go/data/block"
)
// MiniBlocksProviderStub -
type MiniBlocksProviderStub struct {
GetMiniBlocksCalled func(hashes [][]byte) ([]*block.MiniblockAndHash, [][]byte)
GetMiniBlocksFromPoolCalled func(hashes [][]byte) ([]*block.MiniblockAndHash, [][]byte)
GetMiniBlocksFromStorerCalled func(hashes [][]byte) ([]*block.MiniblockAndHash, [][]byte)
}
// GetMiniBlocks -
func (mbps *MiniBlocksProviderStub) GetMiniBlocks(hashes [][]byte) ([]*block.MiniblockAndHash, [][]byte) {
if mbps.GetMiniBlocksCalled != nil {
return mbps.GetMiniBlocksCalled(hashes)
}
return nil, nil
}
// GetMiniBlocksFromPool -
func (mbps *MiniBlocksProviderStub) GetMiniBlocksFromPool(hashes [][]byte) ([]*block.MiniblockAndHash, [][]byte) {
if mbps.GetMiniBlocksFromPoolCalled != nil {
return mbps.GetMiniBlocksFromPoolCalled(hashes)
}
return nil, nil
}
// GetMiniBlocksFromStorer -
func (mbps *MiniBlocksProviderStub) GetMiniBlocksFromStorer(hashes [][]byte) ([]*block.MiniblockAndHash, [][]byte) {
if mbps.GetMiniBlocksFromStorerCalled != nil {
return mbps.GetMiniBlocksFromStorerCalled(hashes)
}
return nil, nil
}
// IsInterfaceNil returns true if there is no value under the interface
func (mbps *MiniBlocksProviderStub) IsInterfaceNil() bool {
return mbps == nil
}