htlcswitch+lnwallet: calculate fee exposure as commit fees + dust
This commit expands the definition of the dust limit to take into account commitment fees as well as dust HTLCs. The dust limit is now known as a fee exposure threshold. Dust HTLCs are fees anyways so it makes sense to account for commitment fees as well. The link has been modified slightly to calculate dust. In the future, the switch dust calculations can be removed.
This commit is contained in:
11 files changed
+456
-88
No files matched your search
@@ -638,7 +638,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
||||
|
||||
s.htlcNotifier = htlcswitch.NewHtlcNotifier(time.Now)
|
||||
|
||||
thresholdSats := btcutil.Amount(cfg.DustThreshold)
|
||||
thresholdSats := btcutil.Amount(cfg.MaxFeeExposure)
|
||||
thresholdMSats := lnwire.NewMSatFromSatoshis(thresholdSats)
|
||||
|
||||
s.aliasMgr, err = aliasmgr.NewManager(dbs.ChanStateDB)
|
||||
@@ -678,7 +678,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
||||
RejectHTLC: cfg.RejectHTLC,
|
||||
Clock: clock.NewDefaultClock(),
|
||||
MailboxDeliveryTimeout: cfg.Htlcswitch.MailboxDeliveryTimeout,
|
||||
DustThreshold: thresholdMSats,
|
||||
MaxFeeExposure: thresholdMSats,
|
||||
SignAliasUpdate: s.signAliasUpdate,
|
||||
IsAlias: aliasmgr.IsAlias,
|
||||
}, uint32(currentHeight))
|
||||
@@ -3863,6 +3863,9 @@ func (s *server) peerConnected(conn net.Conn, connReq *connmgr.ConnReq,
|
||||
towerClient = s.towerClientMgr
|
||||
}
|
||||
|
||||
thresholdSats := btcutil.Amount(s.cfg.MaxFeeExposure)
|
||||
thresholdMSats := lnwire.NewMSatFromSatoshis(thresholdSats)
|
||||
|
||||
// Now that we've established a connection, create a peer, and it to the
|
||||
// set of currently active peers. Configure the peer with the incoming
|
||||
// and outgoing broadcast deltas to prevent htlcs from being accepted or
|
||||
@@ -3932,6 +3935,7 @@ func (s *server) peerConnected(conn net.Conn, connReq *connmgr.ConnReq,
|
||||
RequestAlias: s.aliasMgr.RequestAlias,
|
||||
AddLocalAlias: s.aliasMgr.AddLocalAlias,
|
||||
DisallowRouteBlinding: s.cfg.ProtocolOptions.NoRouteBlinding(),
|
||||
MaxFeeExposure: thresholdMSats,
|
||||
Quit: s.quit,
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user