channeldb: update channeldb to set and store SettleDate for invoices

This commit is contained in:
Micah Lerner authored and Olaoluwa Osuntokun committed 2017-12-08 16:50:04 -08:00
1 parent 231ed5bb32
commit cf6f313cff
2 files changed
+29 -4

No files matched your search

+7 -2
View File
@@ -87,8 +87,9 @@ func TestInvoiceWorkflow(t *testing.T) {
spew.Sdump(fakeInvoice), spew.Sdump(dbInvoice))
}
// Settle the invoice, the versin retreived from the database should
// now have the settled bit toggle to true.
// Settle the invoice, the version retrieved from the database should
// now have the settled bit toggle to true and a non-default
// SettledDate
if err := db.SettleInvoice(paymentHash); err != nil {
t.Fatalf("unable to settle invoice: %v", err)
}
@@ -100,6 +101,10 @@ func TestInvoiceWorkflow(t *testing.T) {
t.Fatalf("invoice should now be settled but isn't")
}
if dbInvoice2.SettleDate.IsZero() {
t.Fatalf("invoice should have non-zero SettledDate but isn't")
}
// Attempt to insert generated above again, this should fail as
// duplicates are rejected by the processing logic.
if err := db.AddInvoice(fakeInvoice); err != ErrDuplicateInvoice {