-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[bug]: Invalid parameters to updatechanpolicy --create_missing_edge makes the channel permanently unfixable #10585
Description
Pre-Submission Checklist
- I have searched the existing issues and believe this is a new bug.
- I am not asking a question about how to use lnd, but reporting a bug (otherwise open a discussion).
LND Version
v0.20.1
LND Configuration
(Nothing relevant)
Backend Version
Bitcoin Core
Backend Configuration
(Nothing relevant)
OS/Distribution
Debian x86
Bug Details & Steps to Reproduce
When using updatechanpolicy --create_missing_edge you only get one chance to get it right. You have to specify all the values for the updatechanpolicy and it's not apparent what all of them are supposed to be. So if you for example put a too big value for max_htlc_msat so you get something like this back:
{
"failed_updates": [
{
"outpoint": "X:x",
"reason": "UPDATE_FAILURE_INVALID_PARAMETER",
"update_error": "max htlc size of X mSAT is above max pending amount of X mSAT"
}
]
}
you are screwed. updatechanpolicy has now put the channel edge in some kind of irrecoverable state that is not fixable. But if you get everything right immediately it does manage to recreate the edge.
Full example:
We accidently put a too big value for max_htlc_msat:
lncli updatechanpolicy --create_missing_edge --min_htlc_msat=X --max_htlc_msat=X X X X X:x
{
"failed_updates": [
{
"outpoint": "X:x",
"reason": "UPDATE_FAILURE_INVALID_PARAMETER",
"update_error": "max htlc size of X mSAT is above max pending amount of X mSAT"
}
]
}
We try again with a valid value:
lncli updatechanpolicy --create_missing_edge --min_htlc_msat=X --max_htlc_msat=X X X X X:x
{
"failed_updates": [
{
"outpoint": "X:x",
"reason": "UPDATE_FAILURE_UNKNOWN",
"update_error": "could not add edge"
}
]
}
We try once again with the same values just because why not:
lncli updatechanpolicy --create_missing_edge --min_htlc_msat=X --max_htlc_msat=X X X X X:x
{
"failed_updates": [
{
"outpoint": "X:x",
"reason": "UPDATE_FAILURE_NOT_FOUND",
"update_error": "edge policy not found"
}
]
}
The channel is now unfixable and further tries will give the same error:
{
"failed_updates": [
{
"outpoint": "X:x",
"reason": "UPDATE_FAILURE_NOT_FOUND",
"update_error": "edge policy not found"
}
]
}
More context: #10567
Possibly related waiting PR: #10516
Expected Behavior
For updatechanpolicy to either fix the channel or to give an error message but not touch (modify) the database at all
Debug Information
No response
Environment
No response