From 851c82b80e1c7be4aa327be98db3f3fe032ec977 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Thu, 20 Oct 2022 19:15:02 +0800 Subject: [PATCH] multi: rename `HTLCExpiry` to `MailboxDeliveryTimeout` for clarity --- htlcswitch/mock.go | 20 +++++++++++--------- htlcswitch/switch.go | 18 +++++++++--------- server.go | 2 +- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/htlcswitch/mock.go b/htlcswitch/mock.go index 0c9bd303f..c544bff15 100644 --- a/htlcswitch/mock.go +++ b/htlcswitch/mock.go @@ -190,15 +190,17 @@ func initSwitchWithDB(startingHeight uint32, db *channeldb.DB) (*Switch, error) EpochChan: make(chan *chainntnfs.BlockEpoch), ConfChan: make(chan *chainntnfs.TxConfirmation), }, - FwdEventTicker: ticker.NewForce(DefaultFwdEventInterval), - LogEventTicker: ticker.NewForce(DefaultLogInterval), - AckEventTicker: ticker.NewForce(DefaultAckInterval), - HtlcNotifier: &mockHTLCNotifier{}, - Clock: clock.NewDefaultClock(), - HTLCExpiry: time.Hour, - DustThreshold: DefaultDustThreshold, - SignAliasUpdate: signAliasUpdate, - IsAlias: isAlias, + FwdEventTicker: ticker.NewForce( + DefaultFwdEventInterval, + ), + LogEventTicker: ticker.NewForce(DefaultLogInterval), + AckEventTicker: ticker.NewForce(DefaultAckInterval), + HtlcNotifier: &mockHTLCNotifier{}, + Clock: clock.NewDefaultClock(), + MailboxDeliveryTimeout: time.Hour, + DustThreshold: DefaultDustThreshold, + SignAliasUpdate: signAliasUpdate, + IsAlias: isAlias, } return New(cfg, startingHeight) diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index c04a42df2..8b2120d3e 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -39,9 +39,9 @@ const ( // fails in a forwarding package. DefaultAckInterval = 15 * time.Second - // DefaultHTLCExpiry is the duration after which Adds will be cancelled - // if they could not get added to an outgoing commitment. - DefaultHTLCExpiry = time.Minute + // DefaultMailboxDeliveryTimeout is the duration after which Adds will + // be cancelled if they could not get added to an outgoing commitment. + DefaultMailboxDeliveryTimeout = time.Minute ) var ( @@ -202,11 +202,11 @@ type Config struct { // Clock is a time source for the switch. Clock clock.Clock - // HTLCExpiry is the interval after which Adds will be cancelled if they - // have not been yet been delivered to a link. The computed deadline - // will expiry this long after the Adds are added to a mailbox via - // AddPacket. - HTLCExpiry time.Duration + // MailboxDeliveryTimeout is the interval after which Adds will be + // cancelled if they have not been yet been delivered to a link. The + // computed deadline will expiry this long after the Adds are added to + // a mailbox via AddPacket. + MailboxDeliveryTimeout time.Duration // DustThreshold is the threshold in milli-satoshis after which we'll // fail incoming or outgoing dust payments for a particular channel. @@ -386,7 +386,7 @@ func New(cfg Config, currentHeight uint32) (*Switch, error) { s.mailOrchestrator = newMailOrchestrator(&mailOrchConfig{ forwardPackets: s.ForwardPackets, clock: s.cfg.Clock, - expiry: s.cfg.HTLCExpiry, + expiry: s.cfg.MailboxDeliveryTimeout, failMailboxUpdate: s.failMailboxUpdate, }) diff --git a/server.go b/server.go index 4fc40e76a..f07b57243 100644 --- a/server.go +++ b/server.go @@ -658,7 +658,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr, AllowCircularRoute: cfg.AllowCircularRoute, RejectHTLC: cfg.RejectHTLC, Clock: clock.NewDefaultClock(), - HTLCExpiry: htlcswitch.DefaultHTLCExpiry, + MailboxDeliveryTimeout: htlcswitch.DefaultMailboxDeliveryTimeout, DustThreshold: thresholdMSats, SignAliasUpdate: s.signAliasUpdate, IsAlias: aliasmgr.IsAlias,