Closed jpentland closed 4 years ago
You'll need to lower the min relay fee for your node.
The min fee was set to 0 in order to make sure that wasn't the issue. I'm also digging through this myself slowly but the code is new to me.
I'm not sure why it returns a "mempool min fee not met" error, but the error is definitely not handled they way it should.
The funding tx is broadcasted from within the wallet (https://sourcegraph.com/github.com/lightningnetwork/lnd@e0baa49/-/blob/lnwallet/wallet.go#L1093)
after the reservation context is already cancelled (https://sourcegraph.com/github.com/lightningnetwork/lnd@e0baa49/-/blob/lnwallet/wallet.go#L1054). This leads to the funding manager trying to fail the funding flow, but since the channel already is transitioned to the openChannelBucket
in the DB, it won't be cancelled.
I think the first step to fixing this would be to move the responsibility of broadcasting the funding tx to the fundingmanager
. That way we can handle the broadcasting error separately from the other errors returned from the wallet.
Handling the broadcasting error would be the second step. We could
1) keep the pending channel around, and retry broadcasting the funding transaction at a later point (we currently do this at startup), and timeout/double spend the transaction later if it doesn't eventually confirm (see #386).
2) assume that a funding tx that fails to broadcast will never make it into the chain, and just cancel the funding flow, deleting the channel from the openChannelBucket
.
I think 2) could be a bit dangerous, as there's no real guarantee that the tx won't eventually confirm (it might reach the network do to some bug say), and then we won't be able to reclaim the funds without some added complexity (keeping the commitment state around until we are sure the inputs are double spent).
Pursuing 1) in tandem with #386 (and maybe #1184) seems to be a safer approach, as this is something we would need to handle regardless. If the mempool min fee is not met, it can be broadcast together with a CPFP to increase the fee.
https://github.com/lightningnetwork/lnd/pull/1635 should handle the fist step mentioned in the above comment. Still won't handle that the transaction never gets published.
@wpaulino has pointed out that the "min mempool fee" error likely is a result of the maxmempool=5
configuration, making the bitcoind
node keep only the 5MB of highest paying transactions in the mempool.
I think it is strange if bitcoind
doesn't prioritize local transactions in the mempool, but I haven't looked into this.
We should also look into why the fee estimator doesn't return a fee that would ensure the transaction we create gets accepted into the mempool.
Also making a note that we should revisit some of the errors returned from PublishTransaction
, as they don't encapsulate all the errors we might want to handle: https://github.com/lightningnetwork/lnd/blob/92b0b10dc75de87be3a9f895c8dfc5a84a2aec7a/lnwallet/btcwallet/btcwallet.go#L424
I also have this issue, stuck funds due to a channel open that used a fee below what I instructed it to open with.
Given that it's a funding transaction and not jointly controlled - wouldn't RBF be the strategy over CPFP?
Problem with RBF is that it changes the funding outpoint, rendering the signed commitment invalid. If RBF is used a new channel must be created with the replacement, then the old channel can be canceled.
I guess it could also require changing the funding amount if you gave more over to fees, so definitely an interactive process unless you are cancelling the channel and spending back to yourself. I'm not sure CPFP will work in a situation like mine though because if the transaction fee is too low the parent fails to relay and CPFP isn't effective
Also I should mention that I didn't see this tracked specifically but the fee estimates targeting 1 sat/byte can result in off-by-one results which are 1 satoshi short of 1 sat/byte which causes stuck tx.
Background
Tried to open open a channel but it failed due to "mempool min fee not met". Channel still shows as pending.
Your environment
version of
lnd
: commit e0baa4969035fc555b185d21acaa0b09aecdef6f (mainnet)which operating system (
uname -a
on *Nix): Linux bitcoin-node 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux (raspberry pi)version of
btcd
,bitcoind
: Bitcoin Core Daemon version v0.16.1wallet balance before:
bitcoind settings:
Note that minrelaytxfee was set to 0 to ensure that low TXs created by LND get forwarded.
Steps to reproduce
Executed openchannel to LIGHTNING.SCOT node:
Expected behaviour
Channel opens, or fails with reason given.
Actual behaviour
lncli
blocked and did not return from the RPC call, had to be killed with CTRL+C.Channel did not open due to "mempool min fee not met".
Channel stuck in pending state, although TX was not broadcast anywhere.
Relevant log output:
Output from lncli afterwards: