Fix sending funding_locked with 1 conf.
authorMatt Corallo <git@bluematt.me>
Mon, 10 Feb 2020 09:27:23 +0000 (10:27 +0100)
committerMatt Corallo <git@bluematt.me>
Mon, 10 Feb 2020 22:09:21 +0000 (17:09 -0500)
commitb02ccbb92f5826e1292f39826bb1008d3b0ffd78
treed787f86fd4da38559aaeaee62874d26e31032ba7
parent88b7dcd7e4b10a53a55be9fc73c81228e377fce5
Fix sending funding_locked with 1 conf.

We previously tracked funding transaction confirmation by marking
funding_tx_confirmations to 1 when we see it in a block and
incrementing each block thereafter if its non-0. To avoid
double-incrementing the first confirmation, we did the increment
(and funding_locked check) after doing the first-confirmation
checks. Thus, we'd never hit the funding_locked case during the
first confirmation.

To address this, we simply swap the order of the checks, though
bumping the funding_tx_confirmations increment up to the top.

Reported-by: Igor Cota <igor@codexapertus.com>
lightning/src/ln/channel.rs