htlcswitch+config: make circular forwarding defence configurable

Add a bool to the switch's config which can be used to disable same
channel circular route checks.
This commit is contained in:
carla 2020-01-30 10:01:18 +02:00
parent a3478f1d99
commit afc7cc7f84
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91
2 changed files with 3 additions and 0 deletions

View File

@ -341,6 +341,8 @@ type config struct {
Watchtower *lncfg.Watchtower `group:"watchtower" namespace:"watchtower"`
LegacyProtocol *lncfg.LegacyProtocol `group:"legacyprotocol" namespace:"legacyprotocol"`
AllowCircularRoute bool `long:"allow-circular-route" description:"If true, our node will allow htlc forwards that arrive and depart on the same channel."`
}
// loadConfig initializes and parses the config using a config file and command

View File

@ -470,6 +470,7 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB,
FwdEventTicker: ticker.New(htlcswitch.DefaultFwdEventInterval),
LogEventTicker: ticker.New(htlcswitch.DefaultLogInterval),
AckEventTicker: ticker.New(htlcswitch.DefaultAckInterval),
AllowCircularRoute: cfg.AllowCircularRoute,
RejectHTLC: cfg.RejectHTLC,
}, uint32(currentHeight))
if err != nil {