Handle if funding output is in a coinbase transaction (ChannelManager, Channel)
https://github.com/lightningdevkit/rust-lightning/pull/1924
Host: dunxen -
Notes
- Miners are able to open a Lightning channel using the coinbase transaction of a new block. However, according to bitcoin consensus rules, the outputs of coinbase transactions are not spendable until they reach 100 blocks, known as the coinbase maturity delay.
- As pointed out in lightning/bolts#1011, Lightning implementations need to ensure that
sending
channel_ready
is delayed for 100 blocks.
Questions
- Did you have a quick glance or review of the PR?
- How do we practically enforce the delay of 100 blocks before sending a
channel_ready
for channels with coinbase funding transaction in the PR? - Why do we not need to worry about adding any buffer on top of the 100 block maturation delay? Think in terms of re-orgs.
- In the Lightning protocol, it’s important that the funding transactions (and all others) are non-malleable (their txids are not malleable). Usually we think of transactions solely spending segwit-style UTXOs as being non-malleable. In what sense are coinbase transactions non-malleable?
- Before this PR was it possible for LDK users (who are miners) to open channels using coinbase transactions with the checks we had. Why or why not?
- How should 0conf coinbase-funded channels be handled? What if we want to close them within the coinbase maturation period?