Switch to height-based funding-tx tracking from conf-based tracking
authorMatt Corallo <git@bluematt.me>
Tue, 16 Mar 2021 00:13:57 +0000 (20:13 -0400)
committerMatt Corallo <git@bluematt.me>
Fri, 2 Apr 2021 17:32:34 +0000 (13:32 -0400)
commit494d7dd4beb4fc11a5ba013d30383becbaa98589
treee02636b7b4082778983678917923e3956b56095c
parent8a8c75a8fc96e5c8ed59e6d80a517bc59215b4d6
Switch to height-based funding-tx tracking from conf-based tracking

Previously, we expected every block to be connected in-order,
allowing us to track confirmations by simply incrementing a counter
for each new block connected. In anticipation of moving to a
update-height model in the next commit, this moves to tracking
confirmations by simply storing the height at which the funding
transaction was confirmed.

This commit also corrects our "funding was reorganized out of the
best chain" heuristic, instead of a flat 6 blocks, it uses half the
confirmation count required as the point at which we force-close.

Even still, for low confirmation counts (eg 1 block), an ill-timed
reorg may still cause spurious force-closes, though that behavior
is not new in this commit.
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs