channeldb: store the invoice counter within the invoice index bucket

This commit moves the location of the invoice counter key which is an
auto-incrementing primary key for all invoices. Rather than storing the counter
in the same top-level invoice bucket, the counter is now stored within the
invoiceIndex bucket. With this change, the top-level bucket can now cleanly be
scanned in a sequential manner to retrieve all invoices.
This commit is contained in:
Olaoluwa Osuntokun
2016-09-19 11:46:48 -07:00
parent 28b72d368c
commit fa70990452
2 changed files with 35 additions and 34 deletions

View File

@@ -9,6 +9,7 @@ var (
ErrChannelNoExist = fmt.Errorf("this channel does not exist")
ErrNoPastDeltas = fmt.Errorf("channel has no recorded deltas")
ErrInvoiceNotFound = fmt.Errorf("unable to locate invoice")
ErrDuplicateInvoice = fmt.Errorf("invoice with payment hash already exists")
ErrInvoiceNotFound = fmt.Errorf("unable to locate invoice")
ErrNoInvoicesCreated = fmt.Errorf("there are no existing invoices")
ErrDuplicateInvoice = fmt.Errorf("invoice with payment hash already exists")
)