Skip to content
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

Set Commitment fee_per_kw for a New Channel #687

Closed
JASchilz opened this issue Jan 28, 2018 · 25 comments
Closed

Set Commitment fee_per_kw for a New Channel #687

JASchilz opened this issue Jan 28, 2018 · 25 comments
Labels
channels commitments Commitment transactions containing the state of the channel enhancement Improvements to existing features / behaviour feature request Requests for new features funding Related to the opening of new channels with funding transactions on the blockchain P3 might get fixed, nice to have

Comments

@JASchilz
Copy link

JASchilz commented Jan 28, 2018

I encountered an error while trying to lncli openchannel with a c-lightning node:

[lncli] rpc error: code = Code(202) desc = feerate_per_kw 2000 below minimum 2201

Details below. The summary is that I'm requesting the ability to set the commitment fee_per_kw for an opening channel, perhaps as a global setting or perhaps as an option during channel creation. I encountered this issue on mainnet.

The error message is produced by c-lightning around openning.c#L602. There's a reference in their code to a relevant bolt spec indicating that a node should refuse channel creation if it believes that the proposed feerate_per_kw is too low.

The c-lightning feerate_per_kw appears equivalent to the LND fee_per_kw. To resolve this issue, I attempted to modify various user-configurable settings that might have an effect on the opening fee_per_kw. I can't say that any of the following should have an effect on channel fee_per_kw, but I tried them anyway:

  • the lnd setting --bitcoin.feerate
  • the --sat_per_byte/--conf-target options on openchannel
  • using lncli's updatechanpolicy before opening a channel

Ultimately, I resolved the issue for myself by adjusting a hard coded target confirmation block in fundingmanager.go#L2293 from 3 to 2.

I'm not familiar enough with the architecture of this project to propose a solution to resolving a channel opening feerate negotiation.

@Roasbeef
Copy link
Member

It's already possible to set the fee rate for the channel opening, see:

⛰ lncli openchannel -h
NAME:
   lncli openchannel - Open a channel to an existing peer.

USAGE:
   lncli openchannel [command options] node-key local-amt push-amt

DESCRIPTION:

  Attempt to open a new channel to an existing peer with the key node-key
  optionally blocking until the channel is 'open'.

  The channel will be initialized with local-amt satoshis local and push-amt
  satoshis for the remote node. Once the channel is open, a channelPoint (txid:vout)
  of the funding output is returned.

  One can manually set the fee to be used for the funding transaction via either
  the --conf_target or --sat_per_byte arguments. This is optional.

  NOTE: peer_id and node_key are mutually exclusive, only one should be used, not both.

OPTIONS:
   --peer_id value        the relative id of the peer to open a channel with (default: 0)
   --node_key value       the identity public key of the target peer serialized in compressed format
   --local_amt value      the number of satoshis the wallet should commit to the channel (default: 0)
   --push_amt value       the number of satoshis to push to the remote side as part of the initial commitment state (default: 0)
   --block                block and wait until the channel is fully open
   --conf_target value    (optional) the number of blocks that the transaction *should* confirm in, will be used for fee estimation (default: 0)
   --sat_per_byte value   (optional) a manual fee expressed in sat/byte that should be used when crafting the transaction (default: 0)
   --private              make the channel private, such that it won't be announced to the greater network, and nodes other than the two channel endpoints must be explicitly told about it to be able to route through it
   --min_htlc_msat value  (optional) the minimum value we will require for incoming HTLCs on the channel (default: 0)

We currently don't consider this an issue as this is due to fee estimation on testnet being wonky.

@Roasbeef
Copy link
Member

Ah, you want the ability to manually set the commitment fee rate.

@JASchilz JASchilz changed the title Set Opening fee_per_kw Set Commitment fee_per_kw for a New Channel Jan 28, 2018
@JASchilz
Copy link
Author

Thank you for the distinction. I've made edits to try clear that up.

@Roasbeef Roasbeef added enhancement Improvements to existing features / behaviour funding Related to the opening of new channels with funding transactions on the blockchain commitments Commitment transactions containing the state of the channel channels feature request Requests for new features labels Jan 28, 2018
@halseth halseth self-assigned this Feb 19, 2018
@Roasbeef Roasbeef added the beginner Issues suitable for new developers label Mar 9, 2018
@stevenroose
Copy link
Contributor

What is the reasoning for allowing a user to specify both target nb of confirmations and sat/byte feerate for the funding tx, but hard coding the commitment to estimation for 3 blocks?

Couldn't the fee settings the user puts be used for both? Also,

// / The target number of blocks that the closure transaction should be confirmed by.
TargetConf int32 `protobuf:"varint,6,opt,name=target_conf,json=targetConf" json:"target_conf,omitempty"`
// / A manual fee rate set in sat/byte that should be used when crafting the closure transaction.
SatPerByte int64 `protobuf:"varint,7,opt,name=sat_per_byte,json=satPerByte" json:"sat_per_byte,omitempty"`

The arguments are for the closure transaction, (aka Closing Transaction from BOLT?), while in the RPC server they are translated to the funding tx params (unless somewhere deeper in the code, the closing tx reuses these params).

Would it make sense to have a minimum fee rate argument that overrules all the estimations (for 3 and 6 block for commitment and funding resp.) when estimation is lower? In that case, bad estimations (too low ones) won't be rejected by other implementations when a reasonable minimum rate is set.

@halseth
Copy link
Contributor

halseth commented Mar 15, 2018

It is a typo, "closure" should be "funding".

Currently you cannot set fee manually for the commitment tx, but that's a desired feature :)

@halseth halseth removed their assignment Mar 15, 2018
@Roasbeef
Copy link
Member

Roasbeef commented Mar 15, 2018 via email

@stevenroose
Copy link
Contributor

That's why I suggested that a minimum fee rate could be a good idea. So that lnd can still overrule when fees rise, but a user can still make sure he has a certain priority when lnd's fee estimation suggests lower fee rates.

@chrisrico
Copy link

chrisrico commented Apr 9, 2018

I'm running into a related issue trying to connect to a c-lightning node. The other side is not accepting the channel because my fee rate is too high. Perhaps both a (local) minimum and maximum could be set at the channel level when opening?

[lncli] rpc error: code = Code(189) desc = You gave bad parameters:feerate_per_kw 43000 above maximum 6310

@Roasbeef
Copy link
Member

Roasbeef commented Apr 9, 2018

IMO clightning should relax the constraints. Note that the initiator is the only that actually pays the fees on the commitment transaction. Therefore they don't really incur a direct penalty by accepting a higher fee rate. Also worth pointing out that this is testnet, and fee estimation is a bit wonky as fees don't matter on testnet at all.

@chrisrico
Copy link

chrisrico commented Apr 9, 2018

I should have mentioned, my issue is on mainnet. But what you say makes sense.

@Roasbeef
Copy link
Member

Roasbeef commented Apr 9, 2018

You gave bad parameters:feerate_per_kw 43000

How long has your btcd node been active? That's a very high fee per kw, especially given how low fee rates are on mainnet these days.

@chrisrico
Copy link

chrisrico commented Apr 9, 2018 via email

@rubenkr
Copy link

rubenkr commented Apr 20, 2018

I have the similar issues here trying to connect to a node it says:

[lncli] rpc error: code = Code(202) desc = feerate_per_kw 250 below minimum 253

pi@BTC-NODE:~ $ uname -a
Linux BTC-NODE 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU/Linux

pi@BTC-NODE:~ $ lncli -v
lncli version 0.4.1 commit=

bitcoind 0.16

Also trying to set fee manually has no luck:

lncli openchannel --node_key xxxx --connect xx.xx.xx.xx:9735 --sat_per_byte 253 --local_amt 20000
[lncli] rpc error: code = Code(202) desc = feerate_per_kw 250 below minimum 253

Thanks for letting me know what I am doing wrong.

Cheers !

@halseth halseth removed the beginner Issues suitable for new developers label Apr 20, 2018
@Roasbeef
Copy link
Member

@rubenkr it's that fees on mainnet are very low right now. The remote party doesn't like the fee level you're suggesting.

@slush0
Copy link

slush0 commented Jun 24, 2018

@Roasbeef I have the same issue as @rubenkr, other node is rejecting with "You gave bad parameters:feerate_per_kw 250 below minimum 253".

Thanks to your comment, I understand what's going wrong, but the solution isn't obvious to me. I didn't find any configuration regards suggesting fee rate from my node's side. The only parameter I see is --sat_per_byte, but regardless of its value, the error message is still the same. What I'm doing wrong?

@Roasbeef
Copy link
Member

Roasbeef commented Jun 24, 2018 via email

@Roasbeef Roasbeef added the P3 might get fixed, nice to have label Jul 10, 2018
@Roasbeef
Copy link
Member

With #3599 it will no longe be critical to set the fee of the commitment transaction, as you'll be able to adjust the fee after broadcast.

@bcwhite-code
Copy link

This is closed, but is there an option to set a specific feerate_per_kw when doing an openchannel? I'm currently getting the error:

You gave bad parameters: feerate_per_kw 6250 below minimum 8122

and can't figure out how to override it.

@guggero
Copy link
Collaborator

guggero commented Jan 3, 2024

You can use --sat_per_vbyte on the command line which will then be converted to feerate_per_kw on the RPC.

@Michilis
Copy link

Michilis commented Jan 8, 2024

i'm getting the same error trying to open a channel to a CLN node.

err=You gave bad parameters: feerate_per_kw 2500 below minimum 5597

Also tried increasing the --sat_per_vbyte with lncli but with no luck and same error.
Are there any other ways to override it or some settings to change?

@Roasbeef
Copy link
Member

Roasbeef commented Jan 8, 2024

You're getting that error as the peer wants you to set a higher fee rate.

@Michilis
Copy link

Michilis commented Jan 8, 2024

How can i set a higher fee rate? Is it another setting then --sat_per_vbyte ?
Or how can the peer lower it?

@Michilis
Copy link

Michilis commented Feb 1, 2024

You can use --sat_per_vbyte on the command line which will then be converted to feerate_per_kw on the RPC.

Changing the channel open fee doesn't seem to have any effect on the error

feerate_per_kw 2500 below minimum 2921

@jaonoctus
Copy link

@Michilis @Roasbeef same thing for me. whatever I type on --sat_per_vbyte, the feerate_per_kw is never higher than 2,500.

im trying to open a channel from lnd v0.17.2-beta to cln v24.02.2

@guggero
Copy link
Collaborator

guggero commented Jun 14, 2024

The commitment fee rate for Anchor channels will never exceed the minimum of --max-commit-fee-rate-anchors setting of two nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
channels commitments Commitment transactions containing the state of the channel enhancement Improvements to existing features / behaviour feature request Requests for new features funding Related to the opening of new channels with funding transactions on the blockchain P3 might get fixed, nice to have
Projects
None yet
Development

No branches or pull requests