Skip to content

Commit 34af813

Browse files
committed
Add comments clarifying that syncing methods shouldn't be used for RPC
1 parent 3026054 commit 34af813

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/chain/mod.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ impl ChainSource {
375375
}
376376
}
377377

378+
// Synchronize the onchain wallet via transaction-based protocols (i.e., Esplora, Electrum,
379+
// etc.)
378380
pub(crate) async fn sync_onchain_wallet(&self) -> Result<(), Error> {
379381
match self {
380382
Self::Esplora {
@@ -490,10 +492,16 @@ impl ChainSource {
490492

491493
res
492494
},
493-
Self::BitcoindRpc { .. } => todo!(),
495+
Self::BitcoindRpc { .. } => {
496+
// In BitcoindRpc mode we sync lightning and onchain wallet in one go by via
497+
// `ChainPoller`. So nothing to do here.
498+
unreachable!("Onchain wallet will be synced via chain polling")
499+
},
494500
}
495501
}
496502

503+
// Synchronize the Lightning wallet via transaction-based protocols (i.e., Esplora, Electrum,
504+
// etc.)
497505
pub(crate) async fn sync_lightning_wallet(
498506
&self, channel_manager: Arc<ChannelManager>, chain_monitor: Arc<ChainMonitor>,
499507
output_sweeper: Arc<Sweeper>,
@@ -583,7 +591,11 @@ impl ChainSource {
583591

584592
res
585593
},
586-
Self::BitcoindRpc { .. } => todo!(),
594+
Self::BitcoindRpc { .. } => {
595+
// In BitcoindRpc mode we sync lightning and onchain wallet in one go by via
596+
// `ChainPoller`. So nothing to do here.
597+
unreachable!("Lightning wallet will be synced via chain polling")
598+
},
587599
}
588600
}
589601

@@ -593,8 +605,9 @@ impl ChainSource {
593605
) -> Result<(), Error> {
594606
match self {
595607
Self::Esplora { .. } => {
596-
debug_assert!(false, "Polling should only be used with chain listeners");
597-
Ok(())
608+
// In Esplora mode we sync lightning and onchain wallets via
609+
// `sync_onchain_wallet` and `sync_lightning_wallet`. So nothing to do here.
610+
unreachable!("Listeners will be synced via transction-based syncing")
598611
},
599612
Self::BitcoindRpc {
600613
bitcoind_rpc_client,

0 commit comments

Comments
 (0)