invoices: jit insert key send invoices

This commit adds handling code for the key send custom record. If this
record is present and its hash matches the payment hash, invoice
registry will insert a new invoice into the database "just in time". The
subsequent settle flow is unchanged. The newly inserted invoice is
picked up and settled. Notifications will be broadcast as usual.
This commit is contained in:
Joost Jager committed 2019-12-23 21:51:19 +01:00
1 parent 202b7c26a7
commit 1d5844c196
8 files changed
+212 -3

No files matched your search

+9 -2
View File
@@ -21,7 +21,8 @@ import (
)
type mockPayload struct {
mpp *record.MPP
mpp *record.MPP
customRecords record.CustomSet
}
func (p *mockPayload) MultiPath() *record.MPP {
@@ -29,7 +30,13 @@ func (p *mockPayload) MultiPath() *record.MPP {
}
func (p *mockPayload) CustomRecords() record.CustomSet {
return make(record.CustomSet)
// This function should always return a map instance, but for mock
// configuration we do accept nil.
if p.customRecords == nil {
return make(record.CustomSet)
}
return p.customRecords
}
var (