lightning / bolts

BOLT: Basis of Lightning Technology (Lightning Network Specifications)
2.1k stars 492 forks source link

Miners can evade the 100 block relative timelock with lightning #1011

Open antonilol opened 2 years ago

antonilol commented 2 years ago

Miners can open a lightning channel directly from the coinbase transaction to spend funds locked in there for 100 blocks by bitcoin's consensus rules earlier. Channels created from coinbase transactions also can't be closed in the 100 blocks after the block has been mined. This can be fixed by either

I believe this an issue of the lightning network (not a specific implementation) an that it should be addressed in the spec

Questions/feedback welcome!

TheBlueMatt commented 2 years ago

Yes, lightning implementations need to specifically check if the funding transaction is a coinbase, and in that case need to delay channel_ready until 100 blocks have passed.

antonilol commented 2 years ago

When (coop or force) closing the channel before the 100 blocks the lightning implementation needs to wait until the close tx is valid an then broadcast it instead of giving the user bitcoind's error and giving up (or if the transaction is rebroadcast every block (and ignores errors) or so that should be fine too)

t-bast commented 1 month ago

Adding a recommendation to the BOLTs would make sense for this: I don't think all implementations do this now!