-
Notifications
You must be signed in to change notification settings - Fork 199
/
blockChainHookHandlerMock.go
56 lines (47 loc) · 1.42 KB
/
blockChainHookHandlerMock.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
53
54
55
56
package mock
import (
"math/big"
"github.com/ElrondNetwork/elrond-go/data"
"github.com/ElrondNetwork/elrond-go/data/state"
"github.com/ElrondNetwork/elrond-go/process"
)
// BlockChainHookHandlerMock -
type BlockChainHookHandlerMock struct {
AddTempAccountCalled func(address []byte, balance *big.Int, nonce uint64)
CleanTempAccountsCalled func()
TempAccountCalled func(address []byte) state.AccountHandler
SetCurrentHeaderCalled func(hdr data.HeaderHandler)
}
// GetBuiltInFunctions -
func (e *BlockChainHookHandlerMock) GetBuiltInFunctions() process.BuiltInFunctionContainer {
return nil
}
// AddTempAccount -
func (e *BlockChainHookHandlerMock) AddTempAccount(address []byte, balance *big.Int, nonce uint64) {
if e.AddTempAccountCalled != nil {
e.AddTempAccountCalled(address, balance, nonce)
}
}
// CleanTempAccounts -
func (e *BlockChainHookHandlerMock) CleanTempAccounts() {
if e.CleanTempAccountsCalled != nil {
e.CleanTempAccountsCalled()
}
}
// TempAccount -
func (e *BlockChainHookHandlerMock) TempAccount(address []byte) state.AccountHandler {
if e.TempAccountCalled != nil {
return e.TempAccountCalled(address)
}
return nil
}
// IsInterfaceNil -
func (e *BlockChainHookHandlerMock) IsInterfaceNil() bool {
return e == nil
}
// SetCurrentHeader -
func (e *BlockChainHookHandlerMock) SetCurrentHeader(hdr data.HeaderHandler) {
if e.SetCurrentHeaderCalled != nil {
e.SetCurrentHeaderCalled(hdr)
}
}