lnd: introduce the InvoiceRegistry

This commit introduces the invoice registry which is a central
repository of all outstanding invoices related to the daemon.

This registry will be used by the goroutines which manage the htlc’s
for a particular channel, and later by the point-to-point workflow
which negotiates the conditions for payment along with signed recipes.
This commit is contained in:
Olaoluwa Osuntokun
2016-07-12 17:14:07 -07:00
parent 0b86c01067
commit e1d5878df4
2 changed files with 82 additions and 0 deletions

View File

@@ -46,6 +46,7 @@ type server struct {
chanDB *channeldb.DB
htlcSwitch *htlcSwitch
invoices *invoiceRegistry
newPeers chan *peer
donePeers chan *peer
@@ -78,6 +79,7 @@ func newServer(listenAddrs []string, wallet *lnwallet.LightningWallet,
chanDB: chanDB,
fundingMgr: newFundingManager(wallet),
htlcSwitch: newHtlcSwitch(),
invoices: newInvoiceRegistry(),
lnwallet: wallet,
identityPriv: privKey,
lightningID: fastsha256.Sum256(serializedPubKey),
@@ -89,6 +91,9 @@ func newServer(listenAddrs []string, wallet *lnwallet.LightningWallet,
quit: make(chan struct{}),
}
// TODO(roasbeef): remove
s.invoices.addInvoice(1000*1e8, *debugPre)
s.rpcServer = newRpcServer(s)
return s, nil