channeldb: convert invoice settle/cancel calls to use Batch
This commit is contained in:
parent
e8da6dd0b4
commit
da76c34418
@ -242,7 +242,9 @@ func (d *DB) AddInvoice(newInvoice *Invoice, paymentHash lntypes.Hash) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
var invoiceAddIndex uint64
|
var invoiceAddIndex uint64
|
||||||
err := d.Update(func(tx *bbolt.Tx) error {
|
err := d.Batch(func(tx *bbolt.Tx) error {
|
||||||
|
invoiceAddIndex = 0
|
||||||
|
|
||||||
invoices, err := tx.CreateBucketIfNotExists(invoiceBucket)
|
invoices, err := tx.CreateBucketIfNotExists(invoiceBucket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -635,7 +637,9 @@ func (d *DB) AcceptOrSettleInvoice(paymentHash [32]byte,
|
|||||||
amtPaid lnwire.MilliSatoshi) (*Invoice, error) {
|
amtPaid lnwire.MilliSatoshi) (*Invoice, error) {
|
||||||
|
|
||||||
var settledInvoice *Invoice
|
var settledInvoice *Invoice
|
||||||
err := d.Update(func(tx *bbolt.Tx) error {
|
err := d.Batch(func(tx *bbolt.Tx) error {
|
||||||
|
settledInvoice = nil
|
||||||
|
|
||||||
invoices, err := tx.CreateBucketIfNotExists(invoiceBucket)
|
invoices, err := tx.CreateBucketIfNotExists(invoiceBucket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -714,7 +718,9 @@ func (d *DB) SettleHoldInvoice(preimage lntypes.Preimage) (*Invoice, error) {
|
|||||||
// payment hash.
|
// payment hash.
|
||||||
func (d *DB) CancelInvoice(paymentHash lntypes.Hash) (*Invoice, error) {
|
func (d *DB) CancelInvoice(paymentHash lntypes.Hash) (*Invoice, error) {
|
||||||
var canceledInvoice *Invoice
|
var canceledInvoice *Invoice
|
||||||
err := d.Update(func(tx *bbolt.Tx) error {
|
err := d.Batch(func(tx *bbolt.Tx) error {
|
||||||
|
canceledInvoice = nil
|
||||||
|
|
||||||
invoices, err := tx.CreateBucketIfNotExists(invoiceBucket)
|
invoices, err := tx.CreateBucketIfNotExists(invoiceBucket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user