Automatically update fees on outbound channels as fees change
authorMatt Corallo <git@bluematt.me>
Mon, 28 Jun 2021 03:41:44 +0000 (03:41 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 13 Aug 2021 21:54:50 +0000 (21:54 +0000)
commit03439ec99f38f65022ff84464a9a3e744cc65266
tree20d797b0ba811dffb84bc4e34b6f5d538e8b3486
parent692b0c78daf432c1bcd6634f90ebf4324c3eb437
Automatically update fees on outbound channels as fees change

Previously we'd been expecting to implement anchor outputs before
shipping 0.1, thus reworking our channel fee update process
entirely and leaving it as a future task. However, due to the
difficulty of working with on-chain anchor pools, we are now likely
to ship 0.1 without requiring anchor outputs.

In either case, there isn't a lot of reason to require that users
call an explicit "prevailing feerates have changed" function now
that we have a timer method which is called regularly. Further, we
really should be the ones deciding on the channel feerate in terms
of the users' FeeEstimator, instead of requiring users implement a
second fee-providing interface by calling an update_fee method.

Finally, there is no reason for an update_fee method to be
channel-specific, as we should be updating all (outbound) channel
fees at once.

Thus, we move the update_fee handling to the background, calling it
on the regular 1-minute timer. We also update the regular 1-minute
timer to fire on startup as well as every minute to ensure we get
fee updates even on mobile clients that are rarely, if ever, open
for more than one minute.
lightning-background-processor/src/lib.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs