Skip to content

Commit ef6895d

Browse files
committed
Fix: Also update the payment store for mempool transactions
When we intially implemented `bitcoind` syncing polling the mempool was very frequent and rather inefficient so we made a choice not to unnecessarily update the payment store for mempool changes, especially since we only consider transactions `Succeeded` after `ANTI_REORG_DELAY` anyways. However, since then we made quite a few peformance improvements to the mempool syncing, and by now we should just update they payment store as not doing so will lead to rather unexpected behavior, making some tests fail for `TestChainSource::Bitcoind`, e.g., `channel_full_cycle_0conf`, which we fix here.
1 parent 8ca908c commit ef6895d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/wallet/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ impl Wallet {
139139
pub(crate) fn apply_mempool_txs(
140140
&self, unconfirmed_txs: Vec<(Transaction, u64)>, evicted_txids: Vec<(Txid, u64)>,
141141
) -> Result<(), Error> {
142+
if unconfirmed_txs.is_empty() {
143+
return Ok(());
144+
}
145+
142146
let mut locked_wallet = self.inner.lock().unwrap();
143147
locked_wallet.apply_unconfirmed_txs(unconfirmed_txs);
144148
locked_wallet.apply_evicted_txs(evicted_txids);
@@ -149,6 +153,11 @@ impl Wallet {
149153
Error::PersistenceFailed
150154
})?;
151155

156+
self.update_payment_store(&mut *locked_wallet).map_err(|e| {
157+
log_error!(self.logger, "Failed to update payment store: {}", e);
158+
Error::PersistenceFailed
159+
})?;
160+
152161
Ok(())
153162
}
154163

0 commit comments

Comments
 (0)