Make `Channel`'s block connection API more electrum-friendly
authorMatt Corallo <git@bluematt.me>
Tue, 16 Mar 2021 00:28:22 +0000 (20:28 -0400)
committerMatt Corallo <git@bluematt.me>
Fri, 2 Apr 2021 17:32:34 +0000 (13:32 -0400)
commit2a432c6fa531c707a8fd69d949834f979ef5d81c
treeeb17466c376ee61acebf3458de0f1211c3db60c1
parent494d7dd4beb4fc11a5ba013d30383becbaa98589
Make `Channel`'s block connection API more electrum-friendly

Electrum clients primarily operate in a world where they query (and
subscribe to notifications for) transactions by script_pubkeys.
They may never learn very much about the actual blockchain and
orient their events around individual transactions, not the
blockchain.

This makes our ChannelManager interface somewhat more amenable to
such a client by splitting `block_connected` into
`transactions_confirmed` and `update_best_block`. The first handles
checking the funding transaction and storing its height/confirmation
block, whereas the second handles funding_locked and reorg logic.

Sadly, this interface is somewhat easy to misuse - notifying the
channel of the funding transaction being reorganized out of the
chain is complicated when the only notification received is that
a new block is connected at a given height. This will be addressed
in a future commit.
lightning/src/ln/channel.rs