Skip to content

Commit 7faae86

Browse files
committed
Drop process_events_async_with_kv_store_sync
We previously introduced a variant of the async background processor that still could take a `KVStoreSync` implementation. This was a crutch for LDK Node which uses the async BP but still relied on `KVStoreSync` everywhere. We now update LDK Node to require also as `KVStore` implementation, allowing us to switch back to the proper `process_events_async`. Hence, we're dropping the intermediate crutch here again, as it's a weird middleground API.
1 parent 444f408 commit 7faae86

File tree

1 file changed

+1
-75
lines changed
  • lightning-background-processor/src

1 file changed

+1
-75
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use lightning::sign::EntropySource;
5555
use lightning::sign::OutputSpender;
5656
use lightning::util::logger::Logger;
5757
use lightning::util::persist::{
58-
KVStore, KVStoreSync, KVStoreSyncWrapper, CHANNEL_MANAGER_PERSISTENCE_KEY,
58+
KVStore, KVStoreSync, CHANNEL_MANAGER_PERSISTENCE_KEY,
5959
CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE, CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE,
6060
NETWORK_GRAPH_PERSISTENCE_KEY, NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE,
6161
NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE, SCORER_PERSISTENCE_KEY,
@@ -1187,80 +1187,6 @@ fn check_and_reset_sleeper<
11871187
}
11881188
}
11891189

1190-
/// Async events processor that is based on [`process_events_async`] but allows for [`KVStoreSync`] to be used for
1191-
/// synchronous background persistence.
1192-
pub async fn process_events_async_with_kv_store_sync<
1193-
UL: 'static + Deref,
1194-
CF: 'static + Deref,
1195-
T: 'static + Deref,
1196-
F: 'static + Deref,
1197-
G: 'static + Deref<Target = NetworkGraph<L>>,
1198-
L: 'static + Deref + Send + Sync,
1199-
P: 'static + Deref,
1200-
EventHandlerFuture: core::future::Future<Output = Result<(), ReplayEvent>>,
1201-
EventHandler: Fn(Event) -> EventHandlerFuture,
1202-
ES: 'static + Deref + Send,
1203-
M: 'static
1204-
+ Deref<Target = ChainMonitor<<CM::Target as AChannelManager>::Signer, CF, T, F, L, P, ES>>
1205-
+ Send
1206-
+ Sync,
1207-
CM: 'static + Deref + Send + Sync,
1208-
OM: 'static + Deref,
1209-
PGS: 'static + Deref<Target = P2PGossipSync<G, UL, L>>,
1210-
RGS: 'static + Deref<Target = RapidGossipSync<G, L>>,
1211-
PM: 'static + Deref,
1212-
LM: 'static + Deref,
1213-
D: 'static + Deref,
1214-
O: 'static + Deref,
1215-
K: 'static + Deref,
1216-
OS: 'static + Deref<Target = OutputSweeper<T, D, F, CF, KVStoreSyncWrapper<K>, L, O>>,
1217-
S: 'static + Deref<Target = SC> + Send + Sync,
1218-
SC: for<'b> WriteableScore<'b>,
1219-
SleepFuture: core::future::Future<Output = bool> + core::marker::Unpin,
1220-
Sleeper: Fn(Duration) -> SleepFuture,
1221-
FetchTime: Fn() -> Option<Duration>,
1222-
>(
1223-
kv_store: K, event_handler: EventHandler, chain_monitor: M, channel_manager: CM,
1224-
onion_messenger: Option<OM>, gossip_sync: GossipSync<PGS, RGS, G, UL, L>, peer_manager: PM,
1225-
liquidity_manager: Option<LM>, sweeper: Option<OS>, logger: L, scorer: Option<S>,
1226-
sleeper: Sleeper, mobile_interruptable_platform: bool, fetch_time: FetchTime,
1227-
) -> Result<(), lightning::io::Error>
1228-
where
1229-
UL::Target: 'static + UtxoLookup,
1230-
CF::Target: 'static + chain::Filter,
1231-
T::Target: 'static + BroadcasterInterface,
1232-
F::Target: 'static + FeeEstimator,
1233-
L::Target: 'static + Logger,
1234-
P::Target: 'static + Persist<<CM::Target as AChannelManager>::Signer>,
1235-
ES::Target: 'static + EntropySource,
1236-
CM::Target: AChannelManager,
1237-
OM::Target: AOnionMessenger,
1238-
PM::Target: APeerManager,
1239-
LM::Target: ALiquidityManager,
1240-
O::Target: 'static + OutputSpender,
1241-
D::Target: 'static + ChangeDestinationSource,
1242-
K::Target: 'static + KVStoreSync,
1243-
{
1244-
let kv_store = KVStoreSyncWrapper(kv_store);
1245-
process_events_async(
1246-
kv_store,
1247-
event_handler,
1248-
chain_monitor,
1249-
channel_manager,
1250-
onion_messenger,
1251-
gossip_sync,
1252-
peer_manager,
1253-
liquidity_manager,
1254-
sweeper,
1255-
logger,
1256-
scorer,
1257-
sleeper,
1258-
mobile_interruptable_platform,
1259-
fetch_time,
1260-
)
1261-
.await
1262-
}
1263-
12641190
#[cfg(feature = "std")]
12651191
impl BackgroundProcessor {
12661192
/// Start a background thread that takes care of responsibilities enumerated in the [top-level

0 commit comments

Comments
 (0)