From 2a9aa092d8f7c445cd8d53460db5affb24c62b7b Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 13 Feb 2018 15:02:53 +0100 Subject: [PATCH] fundingmanager: express fee rates using types, use EstimateFeePerVSize --- fundingmanager.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fundingmanager.go b/fundingmanager.go index ace5ea05..690a8bb6 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -861,7 +861,7 @@ func (f *fundingManager) handleFundingOpen(fmsg *fundingOpenMsg) { // port with default advertised port chainHash := chainhash.Hash(msg.ChainHash) reservation, err := f.cfg.Wallet.InitChannelReservation(amt, 0, - msg.PushAmount, btcutil.Amount(msg.FeePerKiloWeight), 0, + msg.PushAmount, lnwallet.SatPerKWeight(msg.FeePerKiloWeight), 0, fmsg.peerAddress.IdentityKey, fmsg.peerAddress.Address, &chainHash, msg.ChannelFlags) if err != nil { @@ -2337,7 +2337,7 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) { // commitment transaction confirmed by the next few blocks (conf target // of 3). We target the near blocks here to ensure that we'll be able // to execute a timely unilateral channel closure if needed. - feePerWeight, err := f.cfg.FeeEstimator.EstimateFeePerWeight(3) + feePerVSize, err := f.cfg.FeeEstimator.EstimateFeePerVSize(3) if err != nil { msg.err <- err return @@ -2345,7 +2345,7 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) { // The protocol currently operates on the basis of fee-per-kw, so we'll // multiply the computed sat/weight by 1000 to arrive at fee-per-kw. - commitFeePerKw := feePerWeight * 1000 + commitFeePerKw := feePerVSize.FeePerKWeight() // We set the channel flags to indicate whether we want this channel // to be announced to the network. @@ -2359,8 +2359,9 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) { // wallet doesn't have enough funds to commit to this channel, then the // request will fail, and be aborted. reservation, err := f.cfg.Wallet.InitChannelReservation(capacity, - localAmt, msg.pushAmt, commitFeePerKw, msg.fundingFeePerWeight, - peerKey, msg.peerAddress.Address.(*net.TCPAddr), &msg.chainHash, channelFlags) + localAmt, msg.pushAmt, commitFeePerKw, msg.fundingFeePerVSize, + peerKey, msg.peerAddress.Address.(*net.TCPAddr), + &msg.chainHash, channelFlags) if err != nil { msg.err <- err return