Repository navigation
ln_init: use rpc prioritizetransaction to fix channel open order in blocks - #825
Merged
Merged
Conversation
ln_init places each channel at its id.index in the block by giving the funding transactions decreasing fee rates, which only works if every implementation pays exactly the rate it's asked for. They don't: CLN over-estimates the size of its funding transaction (in a mixed network a CLN funding tx asked for 7846 s/vB was mined ahead of an lnd one asked for 7966), and with 200 channels per block the step between neighbours is only 0.5%. Once all funding transactions of a block are in the miner's mempool, use prioritisetransaction so the miner ranks each one at exactly its requested fee rate, independent of what it actually paid. Also wait for those exact transactions in the mining tank's mempool instead of counting transactions in tank 0's, which is not the miner when --miner is used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Now that ln_init orders funding transactions in their block with prioritisetransaction on the miner, the fee they actually pay no longer determines their position. Open every channel at 10 s/vB instead of a decreasing schedule starting at 80006 s/vB, which burned ~0.1 BTC per channel. An explicit rate is still passed because a new regtest chain has no fee estimates. Ranking uses (channels in block - index + 1) * 1000 s/vB, which is strictly decreasing and well above anything else in the mempool. CLN interprets a feerate without a unit suffix as sat/kvB, so it paid 1000x less than asked. That was harmless at 80006 s/vB but would be 0.01 s/vB now, below the relay minimum, so pass the rate in perkb. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
push_msat is in millisatoshis, but was given the channel's push amount, which is in satoshis, so CLN pushed 1000x less than intended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
this is much more precise than expecting all LN implementations to get their fee rates exactly right