From a7e0d3f57b5b0198026ddcc8cb4cee8b8b6a3f0d Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Mon, 2 Jul 2018 13:10:02 -0700 Subject: [PATCH] fundingmanager: determine our dust limit based on active chain In this commit, we fix an issue where we would always assume the dust limit was Bitcoin's dust limit, rather than the active chain. This would lead to issues when attempting to open channels on the Litecon chain. --- fundingmanager.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fundingmanager.go b/fundingmanager.go index b06464fb..a07210f8 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -2504,11 +2504,19 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) { localAmt = msg.localFundingAmt remoteAmt = msg.remoteFundingAmt capacity = localAmt + remoteAmt - ourDustLimit = lnwallet.DefaultDustLimit() minHtlc = msg.minHtlc remoteCsvDelay = msg.remoteCsvDelay ) + // We'll determine our dust limit depending on which chain is active. + var ourDustLimit btcutil.Amount + switch registeredChains.PrimaryChain() { + case bitcoinChain: + ourDustLimit = lnwallet.DefaultDustLimit() + case litecoinChain: + ourDustLimit = defaultLitecoinDustLimit + } + fndgLog.Infof("Initiating fundingRequest(localAmt=%v, remoteAmt=%v, "+ "capacity=%v, chainhash=%v, addr=%v, dustLimit=%v)", localAmt, msg.pushAmt, capacity, msg.chainHash, msg.peerAddress.Address,