channeldb: convert settled boolean to state

This commit is a preparation for the addition of new invoice
states. A database migration is not needed because we keep
the same field length and values.
This commit is contained in:
Joost Jager committed 2019-01-04 07:53:55 +01:00
1 parent 552a9b7190
commit 5515713b88
8 files changed
+88 -46

No files matched your search

+3 -1
View File
@@ -3303,6 +3303,8 @@ func createRPCInvoice(invoice *channeldb.Invoice) (*lnrpc.Invoice, error) {
satAmt := invoice.Terms.Value.ToSatoshis()
satAmtPaid := invoice.AmtPaid.ToSatoshis()
isSettled := invoice.Terms.State == channeldb.ContractSettled
return &lnrpc.Invoice{
Memo: string(invoice.Memo[:]),
Receipt: invoice.Receipt[:],
@@ -3311,7 +3313,7 @@ func createRPCInvoice(invoice *channeldb.Invoice) (*lnrpc.Invoice, error) {
Value: int64(satAmt),
CreationDate: invoice.CreationDate.Unix(),
SettleDate: settleDate,
Settled: invoice.Terms.Settled,
Settled: isSettled,
PaymentRequest: paymentRequest,
DescriptionHash: descHash,
Expiry: expiry,