From 2f927493c8a3f522d630a3c46cab567e9fe1adee Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Mon, 1 Apr 2019 11:51:29 -0700 Subject: [PATCH] Revert "channeldb: convert invoice settle/cancel calls to use Batch" This reverts commit da76c34418a40761fdc99e11200755661699f7eb. --- channeldb/invoices.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/channeldb/invoices.go b/channeldb/invoices.go index 5e3c6202..47a8e199 100644 --- a/channeldb/invoices.go +++ b/channeldb/invoices.go @@ -242,9 +242,7 @@ func (d *DB) AddInvoice(newInvoice *Invoice, paymentHash lntypes.Hash) ( } var invoiceAddIndex uint64 - err := d.Batch(func(tx *bbolt.Tx) error { - invoiceAddIndex = 0 - + err := d.Update(func(tx *bbolt.Tx) error { invoices, err := tx.CreateBucketIfNotExists(invoiceBucket) if err != nil { return err @@ -637,9 +635,7 @@ func (d *DB) AcceptOrSettleInvoice(paymentHash [32]byte, amtPaid lnwire.MilliSatoshi) (*Invoice, error) { var settledInvoice *Invoice - err := d.Batch(func(tx *bbolt.Tx) error { - settledInvoice = nil - + err := d.Update(func(tx *bbolt.Tx) error { invoices, err := tx.CreateBucketIfNotExists(invoiceBucket) if err != nil { return err @@ -718,9 +714,7 @@ func (d *DB) SettleHoldInvoice(preimage lntypes.Preimage) (*Invoice, error) { // payment hash. func (d *DB) CancelInvoice(paymentHash lntypes.Hash) (*Invoice, error) { var canceledInvoice *Invoice - err := d.Batch(func(tx *bbolt.Tx) error { - canceledInvoice = nil - + err := d.Update(func(tx *bbolt.Tx) error { invoices, err := tx.CreateBucketIfNotExists(invoiceBucket) if err != nil { return err