lnrpc: report invoice state
Expose the new invoice state field over rpc.
This commit is contained in:
4 files changed
+613
-540
No files matched your search
@@ -3305,6 +3305,16 @@ func createRPCInvoice(invoice *channeldb.Invoice) (*lnrpc.Invoice, error) {
|
||||
|
||||
isSettled := invoice.Terms.State == channeldb.ContractSettled
|
||||
|
||||
var state lnrpc.Invoice_InvoiceState
|
||||
switch invoice.Terms.State {
|
||||
case channeldb.ContractOpen:
|
||||
state = lnrpc.Invoice_OPEN
|
||||
case channeldb.ContractSettled:
|
||||
state = lnrpc.Invoice_SETTLED
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown invoice state")
|
||||
}
|
||||
|
||||
return &lnrpc.Invoice{
|
||||
Memo: string(invoice.Memo[:]),
|
||||
Receipt: invoice.Receipt[:],
|
||||
@@ -3326,6 +3336,7 @@ func createRPCInvoice(invoice *channeldb.Invoice) (*lnrpc.Invoice, error) {
|
||||
AmtPaidSat: int64(satAmtPaid),
|
||||
AmtPaidMsat: int64(invoice.AmtPaid),
|
||||
AmtPaid: int64(invoice.AmtPaid),
|
||||
State: state,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user