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:
8 files changed
+212
-3
No files matched your search
@@ -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 (
|
||||
|
||||
Reference in new issue
Block a user