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
2018-12-19 15:56:26 +01:00
parent 552a9b7190
commit 5515713b88
8 changed files with 88 additions and 46 deletions

View File

@@ -720,11 +720,11 @@ func (i *mockInvoiceRegistry) SettleInvoice(rhash chainhash.Hash,
return fmt.Errorf("can't find mock invoice: %x", rhash[:])
}
if invoice.Terms.Settled {
if invoice.Terms.State == channeldb.ContractSettled {
return nil
}
invoice.Terms.Settled = true
invoice.Terms.State = channeldb.ContractSettled
invoice.AmtPaid = amt
i.invoices[rhash] = invoice