-
Notifications
You must be signed in to change notification settings - Fork 199
/
feeAccumulatorStub.go
54 lines (46 loc) · 1.37 KB
/
feeAccumulatorStub.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
package mock
import "math/big"
// FeeAccumulatorStub is a stub which implements TransactionFeeHandler interface
type FeeAccumulatorStub struct {
CreateBlockStartedCalled func()
GetAccumulatedFeesCalled func() *big.Int
GetDeveloperFeesCalled func() *big.Int
ProcessTransactionFeeCalled func(cost *big.Int, devFee *big.Int, hash []byte)
RevertFeesCalled func(txHashes [][]byte)
}
// RevertFees -
func (f *FeeAccumulatorStub) RevertFees(txHashes [][]byte) {
if f.RevertFeesCalled != nil {
f.RevertFeesCalled(txHashes)
}
}
// CreateBlockStarted -
func (f *FeeAccumulatorStub) CreateBlockStarted() {
if f.CreateBlockStartedCalled != nil {
f.CreateBlockStartedCalled()
}
}
// GetAccumulatedFees -
func (f *FeeAccumulatorStub) GetAccumulatedFees() *big.Int {
if f.GetAccumulatedFeesCalled != nil {
return f.GetAccumulatedFeesCalled()
}
return big.NewInt(0)
}
// GetDeveloperFees -
func (f *FeeAccumulatorStub) GetDeveloperFees() *big.Int {
if f.GetDeveloperFeesCalled != nil {
return f.GetDeveloperFeesCalled()
}
return big.NewInt(0)
}
// ProcessTransactionFee -
func (f *FeeAccumulatorStub) ProcessTransactionFee(cost *big.Int, devFee *big.Int, txHash []byte) {
if f.ProcessTransactionFeeCalled != nil {
f.ProcessTransactionFeeCalled(cost, devFee, txHash)
}
}
// IsInterfaceNil -
func (f *FeeAccumulatorStub) IsInterfaceNil() bool {
return f == nil
}