Merge pull request #79 from halseth/loose-balance-reservation

Lower default max batch fee rate
This commit is contained in:
Johan T. Halseth 2020-09-17 09:54:44 +02:00 committed by GitHub
commit fefcd70a43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,8 +21,8 @@ const (
defaultBidMinDuration = 144
)
// Default max batch fee rate to 500 sat/vbyte.
var defaultMaxBatchFeeRateSatPerKw = chainfee.SatPerKVByte(500 * 1000).FeePerKWeight()
// Default max batch fee rate to 100 sat/vbyte.
const defaultMaxBatchFeeRateSatPerVByte = 100
var ordersCommands = []cli.Command{
{
@ -49,9 +49,9 @@ var ordersCommands = []cli.Command{
var sharedFlags = []cli.Flag{
cli.Uint64Flag{
Name: "max_batch_fee_rate",
Usage: "the maximum fee rate (sat/kw) to use to for " +
Usage: "the maximum fee rate (sat/vbyte) to use to for " +
"the batch transaction",
Value: uint64(defaultMaxBatchFeeRateSatPerKw),
Value: defaultMaxBatchFeeRateSatPerVByte,
},
}
@ -110,7 +110,23 @@ func parseCommonParams(ctx *cli.Context, blockDuration uint32) (*poolrpc.Order,
return nil, fmt.Errorf("unable to parse acct_key: %v", err)
}
params.MaxBatchFeeRateSatPerKw = ctx.Uint64("max_batch_fee_rate")
// Convert the cmd line flag from sat/vbyte to sat/kw which is used
// internally.
satPerByte := ctx.Uint64("max_batch_fee_rate")
if satPerByte == 0 {
return nil, fmt.Errorf("max batch fee rate must be at " +
"least 1 sat/vbyte")
}
satPerKw := chainfee.SatPerKVByte(satPerByte * 1000).FeePerKWeight()
// Because of rounding, we ensure the set rate is at least our fee
// floor.
if satPerKw < chainfee.FeePerKwFloor {
satPerKw = chainfee.FeePerKwFloor
}
params.MaxBatchFeeRateSatPerKw = uint64(satPerKw)
// We'll map the interest rate specified on the command line to our
// internal "rate_fixed" unit.
@ -165,7 +181,7 @@ func parseAccountKey(ctx *cli.Context, args cli.Args) ([]byte, error) {
var ordersSubmitAskCommand = cli.Command{
Name: "ask",
Usage: "offer channel liquidity",
ArgsUsage: "amt acct_key [--rate_fixed=R] [--funding_fee_rate=F] " +
ArgsUsage: "amt acct_key [--rate_fixed=R] [--max_batch_fee_rate=F] " +
"[--max_duration_blocks=M]",
Description: `
Create an offer to provide inbound liquidity to an auction participant