cnct: add comment on expiry calculation
This commit is contained in:
parent
c3560932b6
commit
839752857f
@ -834,6 +834,16 @@ func (h *htlcOutgoingContestResolver) Resolve() (ContractResolver, error) {
|
|||||||
// If the current height is >= expiry-1, then a spend will be valid to
|
// If the current height is >= expiry-1, then a spend will be valid to
|
||||||
// be included in the next block, and we can immediately return the
|
// be included in the next block, and we can immediately return the
|
||||||
// resolver.
|
// resolver.
|
||||||
|
//
|
||||||
|
// TODO(joostjager): Statement above may not be valid. For CLTV locks,
|
||||||
|
// the expiry value is the last _invalid_ block. The likely reason that
|
||||||
|
// this does not create a problem, is that utxonursery is checking the
|
||||||
|
// expiry again (in the proper way). Same holds for minus one operation
|
||||||
|
// below.
|
||||||
|
//
|
||||||
|
// Source:
|
||||||
|
// https://github.com/btcsuite/btcd/blob/991d32e72fe84d5fbf9c47cd604d793a0cd3a072/blockchain/validate.go#L154
|
||||||
|
|
||||||
if uint32(currentHeight) >= h.htlcResolution.Expiry-1 {
|
if uint32(currentHeight) >= h.htlcResolution.Expiry-1 {
|
||||||
log.Infof("%T(%v): HTLC has expired (height=%v, expiry=%v), "+
|
log.Infof("%T(%v): HTLC has expired (height=%v, expiry=%v), "+
|
||||||
"transforming into timeout resolver", h,
|
"transforming into timeout resolver", h,
|
||||||
|
Loading…
Reference in New Issue
Block a user