Skip to content

Commit 5d60790

Browse files
joostjagerclaude
andcommitted
Convert export_pathfinding_scores to async KVStore
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8219c17 commit 5d60790

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

bindings/ldk_node.udl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ interface Node {
194194
NetworkGraph network_graph();
195195
string sign_message([ByRef]sequence<u8> msg);
196196
boolean verify_signature([ByRef]sequence<u8> msg, [ByRef]string sig, [ByRef]PublicKey pkey);
197-
[Throws=NodeError]
197+
[Async, Throws=NodeError]
198198
bytes export_pathfinding_scores();
199199
};
200200

src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ use lightning::ln::channelmanager::PaymentId;
146146
use lightning::ln::funding::SpliceContribution;
147147
use lightning::ln::msgs::SocketAddress;
148148
use lightning::routing::gossip::NodeAlias;
149-
use lightning::util::persist::KVStoreSync;
149+
use lightning::util::persist::KVStore;
150150
use lightning_background_processor::process_events_async;
151151
use liquidity::{LSPS1Liquidity, LiquiditySource};
152152
use logger::{log_debug, log_error, log_info, log_trace, LdkLogger, Logger};
@@ -1760,13 +1760,14 @@ impl Node {
17601760

17611761
/// Exports the current state of the scorer. The result can be shared with and merged by light nodes that only have
17621762
/// a limited view of the network.
1763-
pub fn export_pathfinding_scores(&self) -> Result<Vec<u8>, Error> {
1764-
KVStoreSync::read(
1763+
pub async fn export_pathfinding_scores(&self) -> Result<Vec<u8>, Error> {
1764+
KVStore::read(
17651765
&*self.kv_store,
17661766
lightning::util::persist::SCORER_PERSISTENCE_PRIMARY_NAMESPACE,
17671767
lightning::util::persist::SCORER_PERSISTENCE_SECONDARY_NAMESPACE,
17681768
lightning::util::persist::SCORER_PERSISTENCE_KEY,
17691769
)
1770+
.await
17701771
.map_err(|e| {
17711772
log_error!(
17721773
self.logger,

0 commit comments

Comments
 (0)