-
Notifications
You must be signed in to change notification settings - Fork 199
/
unsignedTxHandlerStub.go
94 lines (78 loc) · 2.27 KB
/
unsignedTxHandlerStub.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package testscommon
import (
"math/big"
"github.com/ElrondNetwork/elrond-go-core/data"
)
// UnsignedTxHandlerStub -
type UnsignedTxHandlerStub struct {
CleanProcessedUtxsCalled func()
ProcessTransactionFeeCalled func(cost *big.Int, fee *big.Int, hash []byte)
CreateAllUTxsCalled func() []data.TransactionHandler
VerifyCreatedUTxsCalled func() error
AddTxFeeFromBlockCalled func(tx data.TransactionHandler)
GetAccumulatedFeesCalled func() *big.Int
GetDeveloperFeesCalled func() *big.Int
RevertFeesCalled func(txHashes [][]byte)
}
// RevertFees -
func (ut *UnsignedTxHandlerStub) RevertFees(txHashes [][]byte) {
if ut.RevertFeesCalled != nil {
ut.RevertFeesCalled(txHashes)
}
}
// CreateBlockStarted -
func (ut *UnsignedTxHandlerStub) CreateBlockStarted() {
}
// GetAccumulatedFees -
func (ut *UnsignedTxHandlerStub) GetAccumulatedFees() *big.Int {
if ut.GetAccumulatedFeesCalled != nil {
return ut.GetAccumulatedFeesCalled()
}
return big.NewInt(0)
}
// GetDeveloperFees -
func (ut *UnsignedTxHandlerStub) GetDeveloperFees() *big.Int {
if ut.GetDeveloperFeesCalled != nil {
return ut.GetDeveloperFeesCalled()
}
return big.NewInt(0)
}
// AddRewardTxFromBlock -
func (ut *UnsignedTxHandlerStub) AddRewardTxFromBlock(tx data.TransactionHandler) {
if ut.AddTxFeeFromBlockCalled == nil {
return
}
ut.AddTxFeeFromBlockCalled(tx)
}
// CleanProcessedUTxs -
func (ut *UnsignedTxHandlerStub) CleanProcessedUTxs() {
if ut.CleanProcessedUtxsCalled == nil {
return
}
ut.CleanProcessedUtxsCalled()
}
// ProcessTransactionFee -
func (ut *UnsignedTxHandlerStub) ProcessTransactionFee(cost *big.Int, devFee *big.Int, txHash []byte) {
if ut.ProcessTransactionFeeCalled == nil {
return
}
ut.ProcessTransactionFeeCalled(cost, devFee, txHash)
}
// CreateAllUTxs -
func (ut *UnsignedTxHandlerStub) CreateAllUTxs() []data.TransactionHandler {
if ut.CreateAllUTxsCalled == nil {
return nil
}
return ut.CreateAllUTxsCalled()
}
// VerifyCreatedUTxs -
func (ut *UnsignedTxHandlerStub) VerifyCreatedUTxs() error {
if ut.VerifyCreatedUTxsCalled == nil {
return nil
}
return ut.VerifyCreatedUTxsCalled()
}
// IsInterfaceNil returns true if there is no value under the interface
func (ut *UnsignedTxHandlerStub) IsInterfaceNil() bool {
return ut == nil
}