mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-07 21:50:07 +02:00
rpcserver: add SettleDate to rpcserver invoice response
This commit is contained in:
parent
cf6f313cff
commit
0f3ff119e8
@ -2262,10 +2262,14 @@ func testInvoiceSubscriptions(net *networkHarness, t *harnessTest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The invoice update should exactly match the invoice created
|
// The invoice update should exactly match the invoice created
|
||||||
// above, but should now be settled.
|
// above, but should now be settled and have SettleDate
|
||||||
if !invoiceUpdate.Settled {
|
if !invoiceUpdate.Settled {
|
||||||
t.Fatalf("invoice not settled but shoudl be")
|
t.Fatalf("invoice not settled but shoudl be")
|
||||||
}
|
}
|
||||||
|
if invoiceUpdate.SettleDate == 0 {
|
||||||
|
t.Fatalf("invoice should have non zero settle date, but doesn't")
|
||||||
|
}
|
||||||
|
|
||||||
if !bytes.Equal(invoiceUpdate.RPreimage, invoice.RPreimage) {
|
if !bytes.Equal(invoiceUpdate.RPreimage, invoice.RPreimage) {
|
||||||
t.Fatalf("payment preimages don't match: expected %v, got %v",
|
t.Fatalf("payment preimages don't match: expected %v, got %v",
|
||||||
invoice.RPreimage, invoiceUpdate.RPreimage)
|
invoice.RPreimage, invoiceUpdate.RPreimage)
|
||||||
|
@ -2123,6 +2123,11 @@ func createRPCInvoice(invoice *channeldb.Invoice) (*lnrpc.Invoice, error) {
|
|||||||
fallbackAddr = decoded.FallbackAddr.String()
|
fallbackAddr = decoded.FallbackAddr.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settleDate := int64(0)
|
||||||
|
if !invoice.SettleDate.IsZero() {
|
||||||
|
settleDate = invoice.SettleDate.Unix()
|
||||||
|
}
|
||||||
|
|
||||||
// Expiry time will default to 3600 seconds if not specified
|
// Expiry time will default to 3600 seconds if not specified
|
||||||
// explicitly.
|
// explicitly.
|
||||||
expiry := int64(decoded.Expiry().Seconds())
|
expiry := int64(decoded.Expiry().Seconds())
|
||||||
@ -2140,6 +2145,7 @@ func createRPCInvoice(invoice *channeldb.Invoice) (*lnrpc.Invoice, error) {
|
|||||||
RPreimage: preimage[:],
|
RPreimage: preimage[:],
|
||||||
Value: int64(satAmt),
|
Value: int64(satAmt),
|
||||||
CreationDate: invoice.CreationDate.Unix(),
|
CreationDate: invoice.CreationDate.Unix(),
|
||||||
|
SettleDate: settleDate,
|
||||||
Settled: invoice.Terms.Settled,
|
Settled: invoice.Terms.Settled,
|
||||||
PaymentRequest: paymentRequest,
|
PaymentRequest: paymentRequest,
|
||||||
DescriptionHash: descHash,
|
DescriptionHash: descHash,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user