@@ -16,9 +16,6 @@ import (
16
16
"time"
17
17
)
18
18
19
- const InflationRewardLamports = 10
20
- const FeeRewardLamports = 10
21
-
22
19
type (
23
20
Simulator struct {
24
21
Server * rpc.MockServer
@@ -28,17 +25,21 @@ type (
28
25
Epoch int
29
26
TransactionCount int
30
27
31
- SlotTime time.Duration
32
- EpochSize int
33
- LeaderSchedule map [string ][]int
34
- Nodekeys []string
35
- Votekeys []string
28
+ // constants for the simulator
29
+ SlotTime time.Duration
30
+ EpochSize int
31
+ LeaderSchedule map [string ][]int
32
+ Nodekeys []string
33
+ Votekeys []string
34
+ FeeRewardLamports int
35
+ InflationRewardLamports int
36
36
}
37
37
)
38
38
39
39
func NewSimulator (t * testing.T , slot int ) (* Simulator , * rpc.Client ) {
40
40
nodekeys := []string {"aaa" , "bbb" , "ccc" }
41
41
votekeys := []string {"AAA" , "BBB" , "CCC" }
42
+ feeRewardLamports , inflationRewardLamports := 10 , 10
42
43
43
44
validatorInfos := make (map [string ]rpc.MockValidatorInfo )
44
45
for i , nodekey := range nodekeys {
@@ -68,21 +69,23 @@ func NewSimulator(t *testing.T, slot int) (*Simulator, *rpc.Client) {
68
69
"CCC" : 6 * rpc .LamportsInSol ,
69
70
},
70
71
map [string ]int {
71
- "AAA" : InflationRewardLamports ,
72
- "BBB" : InflationRewardLamports ,
73
- "CCC" : InflationRewardLamports ,
72
+ "AAA" : inflationRewardLamports ,
73
+ "BBB" : inflationRewardLamports ,
74
+ "CCC" : inflationRewardLamports ,
74
75
},
75
76
nil ,
76
77
validatorInfos ,
77
78
)
78
79
simulator := Simulator {
79
- Slot : 0 ,
80
- Server : mockServer ,
81
- EpochSize : 24 ,
82
- SlotTime : 100 * time .Millisecond ,
83
- LeaderSchedule : leaderSchedule ,
84
- Nodekeys : nodekeys ,
85
- Votekeys : votekeys ,
80
+ Slot : 0 ,
81
+ Server : mockServer ,
82
+ EpochSize : 24 ,
83
+ SlotTime : 100 * time .Millisecond ,
84
+ LeaderSchedule : leaderSchedule ,
85
+ Nodekeys : nodekeys ,
86
+ Votekeys : votekeys ,
87
+ InflationRewardLamports : inflationRewardLamports ,
88
+ FeeRewardLamports : feeRewardLamports ,
86
89
}
87
90
simulator .PopulateSlot (0 )
88
91
if slot > 0 {
@@ -146,7 +149,7 @@ func (c *Simulator) PopulateSlot(slot int) {
146
149
}
147
150
148
151
c .TransactionCount += len (transactions )
149
- block = & rpc.MockBlockInfo {Fee : FeeRewardLamports , Transactions : transactions }
152
+ block = & rpc.MockBlockInfo {Fee : c . FeeRewardLamports , Transactions : transactions }
150
153
}
151
154
// add slot info:
152
155
c .Server .SetOpt (rpc .SlotInfosOpt , slot , rpc.MockSlotInfo {Leader : leader , Block : block })
0 commit comments