@@ -213,8 +213,8 @@ type dbBatch struct {
213213 // ID is the unique identifier of the batch.
214214 ID int32
215215
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
218218
219219 // BatchTxid is the txid of the batch transaction.
220220 BatchTxid chainhash.Hash
@@ -255,11 +255,8 @@ type dbSweep struct {
255255// convertBatchRow converts a batch row from db to a sweepbatcher.Batch struct.
256256func convertBatchRow (row sqlc.SweepBatch ) * dbBatch {
257257 batch := dbBatch {
258- ID : row .ID ,
259- }
260-
261- if row .Confirmed {
262- batch .State = batchOpen
258+ ID : row .ID ,
259+ Confirmed : row .Confirmed ,
263260 }
264261
265262 if row .BatchTxID .Valid {
@@ -288,7 +285,7 @@ func convertBatchRow(row sqlc.SweepBatch) *dbBatch {
288285// it into the database.
289286func batchToInsertArgs (batch dbBatch ) sqlc.InsertBatchParams {
290287 args := sqlc.InsertBatchParams {
291- Confirmed : false ,
288+ Confirmed : batch . Confirmed ,
292289 BatchTxID : sql.NullString {
293290 Valid : true ,
294291 String : batch .BatchTxid .String (),
@@ -305,10 +302,6 @@ func batchToInsertArgs(batch dbBatch) sqlc.InsertBatchParams {
305302 MaxTimeoutDistance : batch .MaxTimeoutDistance ,
306303 }
307304
308- if batch .State == batchConfirmed {
309- args .Confirmed = true
310- }
311-
312305 return args
313306}
314307
@@ -317,7 +310,7 @@ func batchToInsertArgs(batch dbBatch) sqlc.InsertBatchParams {
317310func batchToUpdateArgs (batch dbBatch ) sqlc.UpdateBatchParams {
318311 args := sqlc.UpdateBatchParams {
319312 ID : batch .ID ,
320- Confirmed : false ,
313+ Confirmed : batch . Confirmed ,
321314 BatchTxID : sql.NullString {
322315 Valid : true ,
323316 String : batch .BatchTxid .String (),
@@ -333,10 +326,6 @@ func batchToUpdateArgs(batch dbBatch) sqlc.UpdateBatchParams {
333326 },
334327 }
335328
336- if batch .State == batchConfirmed {
337- args .Confirmed = true
338- }
339-
340329 return args
341330}
342331
0 commit comments