Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4f8109a

Browse files
author
Conor Okus
committed
Removes steps that only work in Kotlin
1 parent a0f1002 commit 4f8109a

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

‎docs/building-a-node-with-ldk/setting-up-a-channel-manager.md‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,8 @@ There are 2 main options for synchronizing to chain on startup:
937937
938938
#### Full Blocks or BIP 157/158 (Compact Block Filters)
939939
940+
You can use LDK's [lightning-block-sync](https://docs.rs/lightning-block-sync/*/lightning_block_sync/) crate. This provides utilities for syncing LDK via a block-based interface.
941+
940942
**Example:**
941943

942944
<CodeSwitcher :languages="{rust:'Rust'}">
@@ -1014,18 +1016,13 @@ chain_tip = Some(
10141016

10151017
</CodeSwitcher>
10161018

1017-
**Implementation notes:**
1019+
::: tip Full block syncing in mobile environments
10181020

1019-
If you are connecting full blocks or using BIP 157/158, then it is recommended to use
1020-
LDK's [`lightning_block_sync`](https://docs.rs/lightning-block-sync/*/lightning_block_sync/) crate as in the example above: the high-level steps that must be done for both `ChannelManager` and each `ChannelMonitor` are as follows:
1021+
Block syncing for mobile clients tends to present several challenges due to resource contraints and network limitiations typically associated with mobile devices. It requires a full node and usually fetches blocks over RPC.
10211022

1022-
1. Get the last blockhash that each object saw.
1023-
- Receive the latest block hash when through [deserializtion](https://docs.rs/lightning/*/lightning/ln/channelmanager/struct.ChannelManagerReadArgs.html) of the `ChannelManager` via `read()`
1024-
- Each `ChannelMonitor`'s is in `channel_manager.channel_monitors`, as the 2nd element in each tuple
1025-
2. For each object, if its latest known blockhash has been reorged out of the chain, then disconnect blocks using `channel_manager.as_Listen().block_disconnected(..)` or `channel_monitor.block_disconnected(..)` until you reach the last common ancestor with the main chain.
1026-
3. For each object, reconnect blocks starting from the common ancestor until it gets to your best known chain tip using `channel_manager.as_Listen().block_connected(..)` and/or `channel_monitor.block_connected(..)`.
1027-
4. Call `channel_manager.chain_sync_completed(..)` to complete the initial sync process.
1023+
Compact block filters (CBFs) are an alternative approach to syncing the blockchain that addresses some of the challenges associated with mobile clients. Please start a [discussion](https://github.com/orgs/lightningdevkit/discussions) if you would like us to expose `lightning-block-sync` in our bindings.
10281024

1025+
:::
10291026

10301027
#### Electrum or Esplora
10311028

@@ -1076,6 +1073,9 @@ tx_sync.sync(confirmables).unwrap();
10761073
<template v-slot:kotlin>
10771074
10781075
```java
1076+
// Note: This example calls the Confirm interface directly. The lightning-transaction-sync crate will
1077+
// be available in the next bindings release.
1078+
10791079
// Retrieve transaction IDs to check the chain for un-confirmation.
10801080
val relevantTxIdsFromChannelManager: Array<ByteArray> = channelManager .as_Confirm().get_relevant_txids()
10811081
val relevantTxIdsFromChannelManager: Array<ByteArray> = chainMonitor.as_Confirm().get_relevant_txids()
@@ -1121,6 +1121,9 @@ channelManagerConstructor.chain_sync_completed(customEventHandler);
11211121
<template v-slot:swift>
11221122
11231123
```Swift
1124+
// Note: This example calls the Confirm interface directly. The lightning-transaction-sync crate will
1125+
// be available in the next bindings release.
1126+
11241127
// Retrieve transaction IDs to check the chain for un-confirmation.
11251128
let relevantTxIds1 = channelManager?.asConfirm().getRelevantTxids() ?? []
11261129
let relevantTxIds2 = chainMonitor?.asConfirm().getRelevantTxids() ?? []

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /