@@ -213,8 +213,8 @@ type dbBatch struct {
213
213
// ID is the unique identifier of the batch.
214
214
ID int32
215
215
216
- // State is the current state of the batch.
217
- State string
216
+ // Confirmed is set when the batch is fully confirmed .
217
+ Confirmed bool
218
218
219
219
// BatchTxid is the txid of the batch transaction.
220
220
BatchTxid chainhash.Hash
@@ -255,11 +255,8 @@ type dbSweep struct {
255
255
// convertBatchRow converts a batch row from db to a sweepbatcher.Batch struct.
256
256
func convertBatchRow (row sqlc.SweepBatch ) * dbBatch {
257
257
batch := dbBatch {
258
- ID : row .ID ,
259
- }
260
-
261
- if row .Confirmed {
262
- batch .State = batchOpen
258
+ ID : row .ID ,
259
+ Confirmed : row .Confirmed ,
263
260
}
264
261
265
262
if row .BatchTxID .Valid {
@@ -288,7 +285,7 @@ func convertBatchRow(row sqlc.SweepBatch) *dbBatch {
288
285
// it into the database.
289
286
func batchToInsertArgs (batch dbBatch ) sqlc.InsertBatchParams {
290
287
args := sqlc.InsertBatchParams {
291
- Confirmed : false ,
288
+ Confirmed : batch . Confirmed ,
292
289
BatchTxID : sql.NullString {
293
290
Valid : true ,
294
291
String : batch .BatchTxid .String (),
@@ -305,10 +302,6 @@ func batchToInsertArgs(batch dbBatch) sqlc.InsertBatchParams {
305
302
MaxTimeoutDistance : batch .MaxTimeoutDistance ,
306
303
}
307
304
308
- if batch .State == batchConfirmed {
309
- args .Confirmed = true
310
- }
311
-
312
305
return args
313
306
}
314
307
@@ -317,7 +310,7 @@ func batchToInsertArgs(batch dbBatch) sqlc.InsertBatchParams {
317
310
func batchToUpdateArgs (batch dbBatch ) sqlc.UpdateBatchParams {
318
311
args := sqlc.UpdateBatchParams {
319
312
ID : batch .ID ,
320
- Confirmed : false ,
313
+ Confirmed : batch . Confirmed ,
321
314
BatchTxID : sql.NullString {
322
315
Valid : true ,
323
316
String : batch .BatchTxid .String (),
@@ -333,10 +326,6 @@ func batchToUpdateArgs(batch dbBatch) sqlc.UpdateBatchParams {
333
326
},
334
327
}
335
328
336
- if batch .State == batchConfirmed {
337
- args .Confirmed = true
338
- }
339
-
340
329
return args
341
330
}
342
331
0 commit comments