@@ -31,7 +31,7 @@ func TestLeaseTransactionsSameSender(t *testing.T) {
31
31
a := require .New (t )
32
32
33
33
var fixture fixtures.RestClientFixture
34
- fixture .Setup (t , filepath .Join ("nettemplates" , "TwoNodes50EachFuture .json" ))
34
+ fixture .Setup (t , filepath .Join ("nettemplates" , "TwoNodes50Each .json" ))
35
35
defer fixture .Shutdown ()
36
36
37
37
client := fixture .LibGoalClient
@@ -85,12 +85,143 @@ func TestLeaseTransactionsSameSender(t *testing.T) {
85
85
a .Equal (bal2 , uint64 (0 ))
86
86
}
87
87
88
+ func TestLeaseRegressionFaultyFirstValidCheckOld_2f3880f7 (t * testing.T ) {
89
+ t .Parallel ()
90
+ a := require .New (t )
91
+
92
+ var fixture fixtures.RestClientFixture
93
+ fixture .Setup (t , filepath .Join ("nettemplates" , "TwoNodes50EachV22.json" ))
94
+ defer fixture .Shutdown ()
95
+
96
+ client := fixture .LibGoalClient
97
+ accountList , err := fixture .GetWalletsSortedByBalance ()
98
+ a .NoError (err )
99
+ account0 := accountList [0 ].Address
100
+ wh , err := client .GetUnencryptedWalletHandle ()
101
+ a .NoError (err )
102
+
103
+ account1 , err := client .GenerateAddress (wh )
104
+ a .NoError (err )
105
+
106
+ account2 , err := client .GenerateAddress (wh )
107
+ a .NoError (err )
108
+
109
+ lease := [32 ]byte {1 , 2 , 3 , 4 }
110
+
111
+ // construct transactions for sending money to account1 and account2
112
+ // from same sender with identical lease
113
+ tx1 , err := client .ConstructPayment (account0 , account1 , 0 , 1000000 , nil , "" , lease , 0 , 0 )
114
+ a .NoError (err )
115
+
116
+ stx1 , err := client .SignTransactionWithWallet (wh , nil , tx1 )
117
+ a .NoError (err )
118
+
119
+ // submitting the first transaction should succeed
120
+ _ , err = client .BroadcastTransaction (stx1 )
121
+ a .NoError (err )
122
+
123
+ // wait for the txids and check balance
124
+ txids := make (map [string ]string )
125
+ txids [stx1 .Txn .ID ().String ()] = account0
126
+
127
+ _ , curRound := fixture .GetBalanceAndRound (account0 )
128
+ confirmed := fixture .WaitForAllTxnsToConfirm (curRound + 5 , txids )
129
+ a .True (confirmed , "lease txn confirmed" )
130
+
131
+ bal1 , _ := fixture .GetBalanceAndRound (account1 )
132
+ bal2 , _ := fixture .GetBalanceAndRound (account2 )
133
+ a .Equal (bal1 , uint64 (1000000 ))
134
+ a .Equal (bal2 , uint64 (0 ))
135
+
136
+ tx2 , err := client .ConstructPayment (account0 , account2 , 0 , 2000000 , nil , "" , lease , 0 , 0 )
137
+ a .NoError (err )
138
+
139
+ stx2 , err := client .SignTransactionWithWallet (wh , nil , tx2 )
140
+ a .NoError (err )
141
+
142
+ // submitting the second transaction should succeed
143
+ _ , err = client .BroadcastTransaction (stx2 )
144
+ a .NoError (err )
145
+
146
+ // wait for the txids and check balance
147
+ txids = make (map [string ]string )
148
+ txids [stx2 .Txn .ID ().String ()] = account0
149
+
150
+ _ , curRound = fixture .GetBalanceAndRound (account0 )
151
+ confirmed = fixture .WaitForAllTxnsToConfirm (curRound + 5 , txids )
152
+ a .True (confirmed , "lease txn confirmed" )
153
+
154
+ bal1 , _ = fixture .GetBalanceAndRound (account1 )
155
+ bal2 , _ = fixture .GetBalanceAndRound (account2 )
156
+ a .Equal (bal1 , uint64 (1000000 ))
157
+ a .Equal (bal2 , uint64 (2000000 ))
158
+ }
159
+
160
+ func TestLeaseRegressionFaultyFirstValidCheckNew_2f3880f7 (t * testing.T ) {
161
+ t .Parallel ()
162
+ a := require .New (t )
163
+
164
+ var fixture fixtures.RestClientFixture
165
+ fixture .Setup (t , filepath .Join ("nettemplates" , "TwoNodes50Each.json" ))
166
+ defer fixture .Shutdown ()
167
+
168
+ client := fixture .LibGoalClient
169
+ accountList , err := fixture .GetWalletsSortedByBalance ()
170
+ a .NoError (err )
171
+ account0 := accountList [0 ].Address
172
+ wh , err := client .GetUnencryptedWalletHandle ()
173
+ a .NoError (err )
174
+
175
+ account1 , err := client .GenerateAddress (wh )
176
+ a .NoError (err )
177
+
178
+ account2 , err := client .GenerateAddress (wh )
179
+ a .NoError (err )
180
+
181
+ lease := [32 ]byte {1 , 2 , 3 , 4 }
182
+
183
+ // construct transactions for sending money to account1 and account2
184
+ // from same sender with identical lease
185
+ tx1 , err := client .ConstructPayment (account0 , account1 , 0 , 1000000 , nil , "" , lease , 0 , 0 )
186
+ a .NoError (err )
187
+
188
+ stx1 , err := client .SignTransactionWithWallet (wh , nil , tx1 )
189
+ a .NoError (err )
190
+
191
+ // submitting the first transaction should succeed
192
+ _ , err = client .BroadcastTransaction (stx1 )
193
+ a .NoError (err )
194
+
195
+ // wait for the txids and check balance
196
+ txids := make (map [string ]string )
197
+ txids [stx1 .Txn .ID ().String ()] = account0
198
+
199
+ _ , curRound := fixture .GetBalanceAndRound (account0 )
200
+ confirmed := fixture .WaitForAllTxnsToConfirm (curRound + 5 , txids )
201
+ a .True (confirmed , "lease txn confirmed" )
202
+
203
+ bal1 , _ := fixture .GetBalanceAndRound (account1 )
204
+ bal2 , _ := fixture .GetBalanceAndRound (account2 )
205
+ a .Equal (bal1 , uint64 (1000000 ))
206
+ a .Equal (bal2 , uint64 (0 ))
207
+
208
+ tx2 , err := client .ConstructPayment (account0 , account2 , 0 , 2000000 , nil , "" , lease , 0 , 0 )
209
+ a .NoError (err )
210
+
211
+ stx2 , err := client .SignTransactionWithWallet (wh , nil , tx2 )
212
+ a .NoError (err )
213
+
214
+ // submitting the second transaction should fail
215
+ _ , err = client .BroadcastTransaction (stx2 )
216
+ a .Error (err )
217
+ }
218
+
88
219
func TestLeaseTransactionsSameSenderDifferentLease (t * testing.T ) {
89
220
t .Parallel ()
90
221
a := require .New (t )
91
222
92
223
var fixture fixtures.RestClientFixture
93
- fixture .Setup (t , filepath .Join ("nettemplates" , "TwoNodes50EachFuture .json" ))
224
+ fixture .Setup (t , filepath .Join ("nettemplates" , "TwoNodes50Each .json" ))
94
225
defer fixture .Shutdown ()
95
226
96
227
client := fixture .LibGoalClient
@@ -151,7 +282,7 @@ func TestLeaseTransactionsDifferentSender(t *testing.T) {
151
282
a := require .New (t )
152
283
153
284
var fixture fixtures.RestClientFixture
154
- fixture .Setup (t , filepath .Join ("nettemplates" , "TwoNodes50EachFuture .json" ))
285
+ fixture .Setup (t , filepath .Join ("nettemplates" , "TwoNodes50Each .json" ))
155
286
defer fixture .Shutdown ()
156
287
157
288
client := fixture .LibGoalClient
@@ -225,7 +356,7 @@ func TestOverlappingLeases(t *testing.T) {
225
356
a := require .New (t )
226
357
227
358
var fixture fixtures.RestClientFixture
228
- fixture .Setup (t , filepath .Join ("nettemplates" , "TwoNodes50EachFuture .json" ))
359
+ fixture .Setup (t , filepath .Join ("nettemplates" , "TwoNodes50Each .json" ))
229
360
defer fixture .Shutdown ()
230
361
231
362
client := fixture .LibGoalClient
0 commit comments