-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multi: switch to sat/kw fees #1644
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b3d5d7a
lnwallet: switch fee estimation to return sat/kw fee rates
wpaulino a63677a
multi: switch to transaction weight to calculate transaction fees
wpaulino 9d2eeb6
multi: update to latest fee estimation interface
wpaulino 336f1c1
rpcserver: convert sat/vbyte fee rates input by the user to sat/kw
wpaulino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,6 @@ import ( | |
"sync/atomic" | ||
"time" | ||
|
||
"google.golang.org/grpc" | ||
|
||
"golang.org/x/crypto/salsa20" | ||
|
||
"github.com/btcsuite/btcd/btcec" | ||
"github.com/btcsuite/btcd/chaincfg/chainhash" | ||
"github.com/btcsuite/btcd/wire" | ||
|
@@ -28,6 +24,8 @@ import ( | |
"github.com/lightningnetwork/lnd/lnwallet" | ||
"github.com/lightningnetwork/lnd/lnwire" | ||
"github.com/lightningnetwork/lnd/routing" | ||
"golang.org/x/crypto/salsa20" | ||
"google.golang.org/grpc" | ||
) | ||
|
||
const ( | ||
|
@@ -68,11 +66,6 @@ const ( | |
// currently accepted on the Litecoin chain within the Lightning | ||
// Protocol. | ||
maxLtcFundingAmount = maxBtcFundingAmount * btcToLtcConversionRate | ||
|
||
// minCommitFeePerKw is the smallest fee rate that we should propose | ||
// for a new fee update. We'll use this as a fee floor when proposing | ||
// and accepting updates. | ||
minCommitFeePerKw = 253 | ||
) | ||
|
||
var ( | ||
|
@@ -1028,8 +1021,8 @@ func (f *fundingManager) handleFundingOpen(fmsg *fundingOpenMsg) { | |
reservation, err := f.cfg.Wallet.InitChannelReservation( | ||
amt, 0, msg.PushAmount, | ||
lnwallet.SatPerKWeight(msg.FeePerKiloWeight), 0, | ||
fmsg.peer.IdentityKey(), fmsg.peer.Address(), | ||
&chainHash, msg.ChannelFlags, | ||
fmsg.peer.IdentityKey(), fmsg.peer.Address(), &chainHash, | ||
msg.ChannelFlags, | ||
) | ||
if err != nil { | ||
fndgLog.Errorf("Unable to initialize reservation: %v", err) | ||
|
@@ -2543,23 +2536,12 @@ 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. | ||
feePerVSize, err := f.cfg.FeeEstimator.EstimateFeePerVSize(3) | ||
commitFeePerKw, err := f.cfg.FeeEstimator.EstimateFeePerKW(3) | ||
if err != nil { | ||
msg.err <- err | ||
return | ||
} | ||
|
||
// If the converted fee-per-kw is below the current widely used policy | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice 😎 |
||
// floor, then we'll use the floor instead. | ||
commitFeePerKw := feePerVSize.FeePerKWeight() | ||
if commitFeePerKw < minCommitFeePerKw { | ||
fndgLog.Infof("Proposed fee rate of %v sat/kw is below min "+ | ||
"of %v sat/kw, using fee floor", int64(commitFeePerKw), | ||
int64(minCommitFeePerKw)) | ||
|
||
commitFeePerKw = minCommitFeePerKw | ||
} | ||
|
||
// We set the channel flags to indicate whether we want this channel to | ||
// be announced to the network. | ||
var channelFlags lnwire.FundingFlag | ||
|
@@ -2573,7 +2555,7 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) { | |
// request will fail, and be aborted. | ||
reservation, err := f.cfg.Wallet.InitChannelReservation( | ||
capacity, localAmt, msg.pushAmt, commitFeePerKw, | ||
msg.fundingFeePerVSize, peerKey, msg.peer.Address(), | ||
msg.fundingFeePerKw, peerKey, msg.peer.Address(), | ||
&msg.chainHash, channelFlags, | ||
) | ||
if err != nil { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍