Skip to content

Commit 432def3

Browse files
committed
Use official releases
1 parent a557da9 commit 432def3

4 files changed

Lines changed: 26 additions & 36 deletions

File tree

orange-sdk/Cargo.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,23 @@ _cashu-tests = ["_test-utils", "cdk-ldk-node", "cdk/mint", "cdk-sqlite", "cdk-ax
2323
[dependencies]
2424
graduated-rebalancer = { path = "../graduated-rebalancer", version = "0.1.0" }
2525

26-
ldk-node = { git = "https://github.com/benthecarman/ldk-node.git", rev = "3ed1d13451239c54616e9f3fe75fa1f748807b15" }
27-
lightning-macros = "0.2.0-beta1"
26+
ldk-node = { version = "0.7.0" }
27+
lightning-macros = "0.2.0"
2828
bitcoin-payment-instructions = { workspace = true }
2929
chrono = { version = "0.4", default-features = false }
3030
rand = { version = "0.8.5", optional = true }
31-
reqwest = { version = "0.12.23", default-features = false, features = ["rustls-tls"] }
3231
breez-sdk-spark = { git = "https://github.com/breez/spark-sdk.git", rev = "1f2e9995230cd582d6b4aa7d06d76b99defb635e", default-features = false, features = ["rustls-tls"], optional = true }
3332
tokio = { version = "1.0", default-features = false, features = ["rt-multi-thread", "sync"] }
3433
uuid = { version = "1.0", default-features = false, optional = true }
35-
cdk = { git = "https://github.com/benthecarman/cdk.git", rev = "f95a3cfc3b48913e399ea6b080d99b5566437d0a", default-features = false, features = ["wallet"], optional = true }
34+
cdk = { version = "0.14.2", default-features = false, features = ["wallet"], optional = true }
3635
serde_json = { version = "1.0", optional = true }
3736
async-trait = "0.1"
3837
log = "0.4.28"
3938

4039
corepc-node = { version = "0.8.0", features = ["29_0", "download"], optional = true }
41-
cdk-ldk-node = { git = "https://github.com/benthecarman/cdk.git", rev = "f95a3cfc3b48913e399ea6b080d99b5566437d0a", optional = true }
42-
cdk-sqlite = { git = "https://github.com/benthecarman/cdk.git", rev = "f95a3cfc3b48913e399ea6b080d99b5566437d0a", optional = true }
43-
cdk-axum = { git = "https://github.com/benthecarman/cdk.git", rev = "f95a3cfc3b48913e399ea6b080d99b5566437d0a", optional = true }
40+
cdk-ldk-node = { version = "0.14.2", optional = true }
41+
cdk-sqlite = { version = "0.14.2", optional = true }
42+
cdk-axum = { version = "0.14.2", optional = true }
4443
axum = { version = "0.8.1", optional = true }
4544

4645
uniffi = { version = "0.29", features = ["cli", "tokio"], optional = true }

orange-sdk/src/lightning_wallet.rs

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ use ldk_node::bitcoin::base64::Engine;
1313
use ldk_node::bitcoin::base64::prelude::BASE64_STANDARD;
1414
use ldk_node::bitcoin::secp256k1::PublicKey;
1515
use ldk_node::bitcoin::{Address, Network};
16+
use ldk_node::config::{AsyncPaymentsRole, BackgroundSyncConfig};
1617
use ldk_node::lightning::ln::channelmanager::PaymentId;
1718
use ldk_node::lightning::ln::msgs::SocketAddress;
1819
use ldk_node::lightning::util::logger::Logger as _;
19-
use ldk_node::lightning::util::persist::KVStore;
2020
use ldk_node::lightning::{log_debug, log_error, log_info};
2121
use ldk_node::lightning_invoice::{Bolt11Invoice, Bolt11InvoiceDescription, Description};
2222
use ldk_node::payment::{
2323
ConfirmationStatus, PaymentDetails, PaymentDirection, PaymentKind, PaymentStatus,
2424
};
25-
use ldk_node::{DynStore, NodeError, UserChannelId, lightning};
25+
use ldk_node::{DynStore, NodeError, UserChannelId};
2626

2727
use graduated_rebalancer::{LightningBalance, ReceivedLightningPayment};
2828

@@ -133,37 +133,14 @@ impl LightningWallet {
133133
},
134134
};
135135

136+
builder.set_async_payments_role(Some(AsyncPaymentsRole::Client))?;
137+
136138
builder.set_custom_logger(Arc::clone(&logger) as Arc<dyn ldk_node::logger::LogWriter>);
137139

138140
builder.set_runtime(runtime.get_handle());
139141

140-
// download scorer and write to storage
141-
// todo switch to https://github.com/lightningdevkit/ldk-node/pull/449 once available
142142
if let Some(url) = config.scorer_url {
143-
let fetch = tokio::time::timeout(std::time::Duration::from_secs(10), reqwest::get(url));
144-
let res = fetch.await.map_err(|e| {
145-
log_error!(logger, "Timed out downloading scorer: {e}");
146-
InitFailure::LdkNodeStartFailure(NodeError::InvalidUri)
147-
})?;
148-
149-
let req = res.map_err(|e| {
150-
log_error!(logger, "Failed to download scorer: {e}");
151-
InitFailure::LdkNodeStartFailure(NodeError::InvalidUri)
152-
})?;
153-
154-
let bytes = req.bytes().await.map_err(|e| {
155-
log_debug!(logger, "Failed to read scorer bytes: {e}");
156-
InitFailure::LdkNodeStartFailure(NodeError::InvalidUri)
157-
})?;
158-
159-
KVStore::write(
160-
store.as_ref(),
161-
lightning::util::persist::SCORER_PERSISTENCE_PRIMARY_NAMESPACE,
162-
lightning::util::persist::SCORER_PERSISTENCE_SECONDARY_NAMESPACE,
163-
lightning::util::persist::SCORER_PERSISTENCE_KEY,
164-
bytes.to_vec(),
165-
)
166-
.await?;
143+
builder.set_pathfinding_scores_source(url);
167144
}
168145

169146
let ldk_node = Arc::new(builder.build_with_store(Arc::clone(&store))?);

orange-sdk/src/trusted_wallet/cashu/cashu_store.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,13 @@ impl WalletDatabase for CashuKvDatabase {
765765
Ok(filtered_proofs)
766766
}
767767

768+
async fn get_balance(
769+
&self, mint_url: Option<MintUrl>, unit: Option<CurrencyUnit>, state: Option<Vec<State>>,
770+
) -> Result<u64, Self::Err> {
771+
let proofs = self.get_proofs(mint_url, unit, state, None).await?;
772+
Ok(proofs.iter().map(|p| u64::from(p.proof.amount)).sum())
773+
}
774+
768775
async fn update_proofs_state(&self, ys: Vec<PublicKey>, state: State) -> Result<(), Self::Err> {
769776
// Update proofs in storage and cache
770777
for y in &ys {

orange-sdk/tests/test_utils.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,15 @@ async fn build_test_nodes() -> TestParams {
427427
})
428428
.await;
429429

430+
let lsp_listen = lsp_listen_clone.to_string();
430431
cdk.node()
431-
.open_channel(lsp_node_id, lsp_listen_clone, 10_000_000, Some(5_000_000_000), None)
432+
.open_channel(
433+
lsp_node_id,
434+
lsp_listen.parse().unwrap(),
435+
10_000_000,
436+
Some(5_000_000_000),
437+
None,
438+
)
432439
.unwrap();
433440
wait_for_tx_broadcast(&bitcoind_clone);
434441
generate_blocks(&bitcoind_clone, 6);

0 commit comments

Comments
 (0)