Allow deserialization of new Channels before we've seen a block 2020-02-chanmon-ser-roundtrip
authorMatt Corallo <git@bluematt.me>
Sat, 15 Feb 2020 17:12:50 +0000 (12:12 -0500)
committerMatt Corallo <git@bluematt.me>
Tue, 18 Feb 2020 23:22:06 +0000 (18:22 -0500)
commit4b189bd09f4ebdf360ff6096d0d337fdd3d3f699
treeb45660b5738fd0c79ef6685c56fd978d6ad09be8
parented2a5fdab91a03e7fca38101a4f235564580912d
Allow deserialization of new Channels before we've seen a block

Previously, if we have a live ChannelManager (that has seen blocks)
and we open a new Channel, if we serialize that ChannelManager
before a new block comes in, we'll fail to deserialize it. This is
the result of an overly-ambigious last_block_connected check which
would see 0s for the new channel but the previous block for the
ChannelManager as a whole.

We add a new test which catches this error as well as hopefully
getting some test coverage for other similar issues in the future.
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs