fundingmanager: express fee rates using types, use EstimateFeePerVSize
This commit is contained in:
1 file changed
+6
-5
+6
-5
@@ -861,7 +861,7 @@ func (f *fundingManager) handleFundingOpen(fmsg *fundingOpenMsg) {
|
|||||||
// port with default advertised port
|
// port with default advertised port
|
||||||
chainHash := chainhash.Hash(msg.ChainHash)
|
chainHash := chainhash.Hash(msg.ChainHash)
|
||||||
reservation, err := f.cfg.Wallet.InitChannelReservation(amt, 0,
|
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,
|
fmsg.peerAddress.IdentityKey, fmsg.peerAddress.Address,
|
||||||
&chainHash, msg.ChannelFlags)
|
&chainHash, msg.ChannelFlags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -2337,7 +2337,7 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
|||||||
// commitment transaction confirmed by the next few blocks (conf target
|
// 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
|
// of 3). We target the near blocks here to ensure that we'll be able
|
||||||
// to execute a timely unilateral channel closure if needed.
|
// 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 {
|
if err != nil {
|
||||||
msg.err <- err
|
msg.err <- err
|
||||||
return
|
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
|
// 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.
|
// 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
|
// We set the channel flags to indicate whether we want this channel
|
||||||
// to be announced to the network.
|
// 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
|
// wallet doesn't have enough funds to commit to this channel, then the
|
||||||
// request will fail, and be aborted.
|
// request will fail, and be aborted.
|
||||||
reservation, err := f.cfg.Wallet.InitChannelReservation(capacity,
|
reservation, err := f.cfg.Wallet.InitChannelReservation(capacity,
|
||||||
localAmt, msg.pushAmt, commitFeePerKw, msg.fundingFeePerWeight,
|
localAmt, msg.pushAmt, commitFeePerKw, msg.fundingFeePerVSize,
|
||||||
peerKey, msg.peerAddress.Address.(*net.TCPAddr), &msg.chainHash, channelFlags)
|
peerKey, msg.peerAddress.Address.(*net.TCPAddr),
|
||||||
|
&msg.chainHash, channelFlags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msg.err <- err
|
msg.err <- err
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in new issue
Block a user