multi: extend InvoiceDB methods with a context argument (#8066)
* multi: extend InvoiceDB methods with a context argument This commit adds a context to InvoiceDB's methods. Along this refactor we also extend InvoiceRegistry methods with contexts where it makes sense. This change is essential to be able to provide kvdb and sqldb implementations for InvoiceDB. * channeldb: restrict invoice tests to only use an InvoiceDB instance * docs: update release notes for 0.18.0
This commit is contained in:
1 parent
9478b85e59
commit
ad5cd9c8bb
18 files changed
+458
-328
No files matched your search
@@ -2,6 +2,7 @@ package htlcswitch
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
crand "crypto/rand"
|
||||
"crypto/sha256"
|
||||
"encoding/binary"
|
||||
@@ -780,7 +781,9 @@ func preparePayment(sendingPeer, receivingPeer lnpeer.Peer,
|
||||
|
||||
// Check who is last in the route and add invoice to server registry.
|
||||
hash := invoice.Terms.PaymentPreimage.Hash()
|
||||
if err := receiver.registry.AddInvoice(*invoice, hash); err != nil {
|
||||
if err := receiver.registry.AddInvoice(
|
||||
context.Background(), *invoice, hash,
|
||||
); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
@@ -1338,7 +1341,9 @@ func (n *twoHopNetwork) makeHoldPayment(sendingPeer, receivingPeer lnpeer.Peer,
|
||||
}
|
||||
|
||||
// Check who is last in the route and add invoice to server registry.
|
||||
if err := receiver.registry.AddInvoice(*invoice, rhash); err != nil {
|
||||
if err := receiver.registry.AddInvoice(
|
||||
context.Background(), *invoice, rhash,
|
||||
); err != nil {
|
||||
paymentErr <- err
|
||||
return paymentErr
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user