Note that we're not using electrumClient.notifications because we'd have to first filter that for instances of HeaderSubscriptionResponse. But we also don't want to wait for a new block to start monitoring. What we really want is a StateFlow<HeaderSubscriptionResponse?> which AppConfigurationManager already provides.
The
payment.confirmedAt
flag wasn't always being set properly, because this collection:paymentsDb.listUnconfirmedTransactions().collect { ... }
only fired when:
So if you create a new unconfirmed tx, and then wait, the above collection won't trigger when the tx is finally mined.
The fix is to simply tweak the collection to also fire when there's a new mined block:
Note that we're not using
electrumClient.notifications
because we'd have to first filter that for instances ofHeaderSubscriptionResponse
. But we also don't want to wait for a new block to start monitoring. What we really want is aStateFlow<HeaderSubscriptionResponse?>
which AppConfigurationManager already provides.