X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Fchainmonitor.rs;h=257f1d0f30bc1db9840b0e2f2da55aa686beef08;hb=b8d4ac1371bf0db3b28339d4e12fadf02f6add3d;hp=06052dc84de52dd3d7257e55ec0aa4bed5ccc9e2;hpb=c1125f00b392432fc29fae8555183b46220bba26;p=rust-lightning diff --git a/lightning/src/chain/chainmonitor.rs b/lightning/src/chain/chainmonitor.rs index 06052dc8..257f1d0f 100644 --- a/lightning/src/chain/chainmonitor.rs +++ b/lightning/src/chain/chainmonitor.rs @@ -31,11 +31,10 @@ use crate::chain::{ChannelMonitorUpdateStatus, Filter, WatchedOutput}; use crate::chain::chaininterface::{BroadcasterInterface, FeeEstimator}; use crate::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, Balance, MonitorEvent, TransactionOutputs, WithChannelMonitor}; use crate::chain::transaction::{OutPoint, TransactionData}; -use crate::ln::ChannelId; +use crate::ln::types::ChannelId; use crate::sign::ecdsa::WriteableEcdsaChannelSigner; use crate::events; use crate::events::{Event, EventHandler}; -use crate::util::atomic_counter::AtomicCounter; use crate::util::logger::{Logger, WithContext}; use crate::util::errors::APIError; use crate::util::wakers::{Future, Notifier}; @@ -221,10 +220,6 @@ pub struct ChainMonitor, { monitors: RwLock>>, - /// When we generate a monitor update for a chain-event monitor persistence, we need a - /// unique ID, which we calculate by simply getting the next value from this counter. Note that - /// the ID is never persisted so it's ok that they reset on restart. - sync_persistence_id: AtomicCounter, chain_source: Option, broadcaster: T, logger: L, @@ -236,6 +231,8 @@ pub struct ChainMonitor, broadcaster: T, logger: L, feeest: F, persister: P) -> Self { Self { monitors: RwLock::new(new_hash_map()), - sync_persistence_id: AtomicCounter::new(), chain_source, broadcaster, logger, @@ -642,6 +638,8 @@ where monitor.block_connected( header, txdata, height, &*self.broadcaster, &*self.fee_estimator, &self.logger) }); + // Assume we may have some new events and wake the event processor + self.event_notifier.notify(); } fn block_disconnected(&self, header: &Header, height: u32) { @@ -669,6 +667,8 @@ where monitor.transactions_confirmed( header, txdata, height, &*self.broadcaster, &*self.fee_estimator, &self.logger) }); + // Assume we may have some new events and wake the event processor + self.event_notifier.notify(); } fn transaction_unconfirmed(&self, txid: &Txid) { @@ -689,6 +689,8 @@ where header, height, &*self.broadcaster, &*self.fee_estimator, &self.logger ) }); + // Assume we may have some new events and wake the event processor + self.event_notifier.notify(); } fn get_relevant_txids(&self) -> Vec<(Txid, u32, Option)> {