mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 22:50:58 +02:00
invoices: optionally hold and auto-cancel keysend payments
Adds a new configuration flag to lnd that will keep keysend payments in the accepted state. An application can then inspect the payment parameters and decide whether to settle or cancel. The on-the-fly inserted keysend invoices get a configurable expiry time. This is a safeguard in case the application that should decide on the keysend payments isn't active.
This commit is contained in:
@@ -34,7 +34,9 @@ func newInvoiceExpiryWatcherTest(t *testing.T, now time.Time,
|
||||
|
||||
test.wg.Add(numExpiredInvoices)
|
||||
|
||||
err := test.watcher.Start(func(paymentHash lntypes.Hash) error {
|
||||
err := test.watcher.Start(func(paymentHash lntypes.Hash,
|
||||
force bool) error {
|
||||
|
||||
test.canceledInvoices = append(test.canceledInvoices, paymentHash)
|
||||
test.wg.Done()
|
||||
return nil
|
||||
@@ -81,7 +83,7 @@ func (t *invoiceExpiryWatcherTest) checkExpectations() {
|
||||
// Tests that InvoiceExpiryWatcher can be started and stopped.
|
||||
func TestInvoiceExpiryWatcherStartStop(t *testing.T) {
|
||||
watcher := NewInvoiceExpiryWatcher(clock.NewTestClock(testTime))
|
||||
cancel := func(lntypes.Hash) error {
|
||||
cancel := func(lntypes.Hash, bool) error {
|
||||
t.Fatalf("unexpected call")
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user