Merge pull request #3414 from joostjager/report-accept-height

lnwire+htlcswitch: report htlc accept height
This commit is contained in:
Joost Jager authored and GitHub committed 2019-09-16 13:49:29 +02:00
commit 95502da7e8
13 files changed
+486 -232

No files matched your search

+4 -4
View File
@@ -272,7 +272,7 @@ type InvoiceHTLC struct {
// State indicates the state the invoice htlc is currently in. A
// cancelled htlc isn't just removed from the invoice htlcs map, because
// we need AcceptedHeight to properly cancel the htlc back.
// we need AcceptHeight to properly cancel the htlc back.
State HtlcState
}
@@ -1224,9 +1224,9 @@ func (d *DB) updateInvoice(hash lntypes.Hash, invoices, settleIndex *bbolt.Bucke
if !ok {
return nil, fmt.Errorf("unknown htlc %v", key)
}
if htlc.State == HtlcStateSettled {
return nil, fmt.Errorf("cannot cancel a " +
"settled htlc")
if htlc.State != HtlcStateAccepted {
return nil, fmt.Errorf("can only cancel " +
"accepted htlcs")
}
htlc.State = HtlcStateCancelled