lnd: extend the invoiceRegistry to wrap on-disk invoices with an in-memory cache

This commit extends the existing invoiceRegistry functionality to wrap
the on-disk invoices available via the channeldb with an in-memory
cache on invoices. Currently the in-memory cache is only reserved for
the storage of special “debug” invoices which all nodes are able to
settle immediately.
This commit is contained in:
Olaoluwa Osuntokun committed 2016-09-21 19:48:22 -07:00
1 parent 39e6217860
commit 0c4293ba82
3 files changed
+91 -52

No files matched your search

+1 -3
View File
@@ -92,7 +92,7 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
chanDB: chanDB,
fundingMgr: newFundingManager(wallet),
htlcSwitch: newHtlcSwitch(),
invoices: newInvoiceRegistry(),
invoices: newInvoiceRegistry(chanDB),
lnwallet: wallet,
identityPriv: privKey,
lightningID: fastsha256.Sum256(serializedPubKey),
@@ -104,8 +104,6 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
quit: make(chan struct{}),
}
// TODO(roasbeef): remove
s.invoices.addInvoice(1000*1e8, *debugPre)
s.utxoNursery = newUtxoNursery(notifier, wallet)