From a3a0efbeb07321090139f8afc7f1f63bc3d0bdc9 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Wed, 29 Nov 2017 14:03:01 +0100 Subject: [PATCH] lnd: populate channel constraints closures in fundingConfig. --- lnd.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lnd.go b/lnd.go index 2d27b6b4..09532fb6 100644 --- a/lnd.go +++ b/lnd.go @@ -388,6 +388,24 @@ func lndMain() error { cid := lnwire.NewChanIDFromOutPoint(&chanPoint) return server.htlcSwitch.UpdateShortChanID(cid, sid) }, + RequiredRemoteChanReserve: func(chanAmt btcutil.Amount) btcutil.Amount { + // By default, we'll require the remote peer to maintain + // at least 1% of the total channel capacity at all + // times. + return chanAmt / 100 + }, + RequiredRemoteMaxValue: func(chanAmt btcutil.Amount) lnwire.MilliSatoshi { + // By default, we'll allow the remote peer to fully + // utilize the full bandwidth of the channel, minus our + // required reserve. + reserve := lnwire.NewMSatFromSatoshis(chanAmt / 100) + return lnwire.NewMSatFromSatoshis(chanAmt) - reserve + }, + RequiredRemoteMaxHTLCs: func(chanAmt btcutil.Amount) uint16 { + // By default, we'll permit them to utilize the full + // channel bandwidth. + return uint16(lnwallet.MaxHTLCNumber / 2) + }, }) if err != nil { return err