Do not wait in PersistenceNotifier when the persist flag is set
authorMatt Corallo <git@bluematt.me>
Fri, 7 May 2021 22:17:29 +0000 (22:17 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 14 May 2021 23:20:27 +0000 (23:20 +0000)
commitfdc11f2c76617bc05d8b2c052186f233a34dc709
tree2b4316124d86fa679c100689002693e1bad017c3
parent316f01a42fb5cfcb0c897eaa48613fa544c4ec0a
Do not wait in PersistenceNotifier when the persist flag is set

When we had a event which caused us to set the persist flag in a
PersistenceNotifier in between wait calls, we will still wait,
potentially not persisting a ChannelManager when we should.

Worse, for wait_timeout, this caused us to always wait up to the
timeout, but then always return true that a persistence is needed.

Instead, we simply check the persist flag before waiting, returning
immediately if it is set.
lightning/src/ln/channelmanager.rs