multi: restructure invoice Terms field

This commit restructures an invoice's ContractTerms to better encompass
the restrictions placed on settling. For instance, the final ctlv delta
and invoice expiry are moved from the main invoice body (where
additional metadata is stored). Additionally, it moves the State field
outside of the terms since it is rather metadata about the invoice
instead of any terms offered to the sender in the payment request.
This commit is contained in:
Conner Fromknecht
2019-11-22 02:25:02 -08:00
parent 6cabea563e
commit 3b253e05f6
8 changed files with 81 additions and 82 deletions

View File

@@ -560,13 +560,13 @@ func generatePaymentWithPreimage(invoiceAmt, htlcAmt lnwire.MilliSatoshi,
invoice := &channeldb.Invoice{
CreationDate: time.Now(),
Terms: channeldb.ContractTerm{
FinalCltvDelta: testInvoiceCltvExpiry,
Value: invoiceAmt,
PaymentPreimage: preimage,
Features: lnwire.NewFeatureVector(
nil, lnwire.Features,
),
},
FinalCltvDelta: testInvoiceCltvExpiry,
}
htlc := &lnwire.UpdateAddHTLC{