channeldb: add persistent invoice workflow

This commit adds the necessary database functionality required for a
high-level payment invoice workflow. Invoices can be added dealing the
requirements for fulfillment, looked by payment hash, and the finally
also settled by payment hash. For record keeping and the possibility of
reconciling future disputes, invoices are currently never deleted from
disk. Instead when an invoice is settled a bit is toggled indicating as
much.

The current invoiceManger within the daemon will be modified to use
this persistent invoice store, only storing certain “debug” invoices in
memory as dictated by a command line flag.
This commit is contained in:
Olaoluwa Osuntokun
2016-09-16 17:23:37 -07:00
parent 255b1b7727
commit b264ba198f
3 changed files with 423 additions and 0 deletions

View File

@@ -8,4 +8,7 @@ var (
ErrNoActiveChannels = fmt.Errorf("no active channels exist")
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")
)