[[package]]
name = "lightning"
-version = "0.0.13"
-source = "git+https://github.com/rust-bitcoin/rust-lightning?rev=d4d322580994857b1222488f8467311d6db61482#d4d322580994857b1222488f8467311d6db61482"
+version = "0.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f99cce0a9a62b73144dad86cf9d722379db3de049fec5df8f5437a6c92542ab"
dependencies = [
"bitcoin",
]
[[package]]
name = "lightning-background-processor"
-version = "0.0.13"
-source = "git+https://github.com/rust-bitcoin/rust-lightning?rev=d4d322580994857b1222488f8467311d6db61482#d4d322580994857b1222488f8467311d6db61482"
+version = "0.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7cd5d18b3f9c4f7ab6c5554411f2e6618f98e4b7dcb6426be2266267dfa8d499"
dependencies = [
"bitcoin",
"lightning",
[[package]]
name = "lightning-block-sync"
-version = "0.0.13"
-source = "git+https://github.com/rust-bitcoin/rust-lightning?rev=d4d322580994857b1222488f8467311d6db61482#d4d322580994857b1222488f8467311d6db61482"
+version = "0.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "40a773c6711f798c04e14bff4a83220c7d47d9f76cecf6cc5754693b2600f7d1"
dependencies = [
"bitcoin",
"chunked_transfer",
[[package]]
name = "lightning-invoice"
-version = "0.4.0"
-source = "git+https://github.com/rust-bitcoin/rust-lightning?rev=d4d322580994857b1222488f8467311d6db61482#d4d322580994857b1222488f8467311d6db61482"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0738f41c16a3501726c4ada573cad59835e4ee66c1e7d08a4ae4d6b7baa9268"
dependencies = [
"bech32 0.7.2",
"bitcoin_hashes",
[[package]]
name = "lightning-net-tokio"
-version = "0.0.13"
-source = "git+https://github.com/rust-bitcoin/rust-lightning?rev=d4d322580994857b1222488f8467311d6db61482#d4d322580994857b1222488f8467311d6db61482"
+version = "0.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c593aacfff258a317513a409088b92bc1dc8fb28a4a8f2826b827553435e8d9b"
dependencies = [
"bitcoin",
"lightning",
[[package]]
name = "lightning-persister"
-version = "0.0.13"
-source = "git+https://github.com/rust-bitcoin/rust-lightning?rev=d4d322580994857b1222488f8467311d6db61482#d4d322580994857b1222488f8467311d6db61482"
+version = "0.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "83dc14f2dfed0a6eaddae9e2b54998e327f63fc0bcb64bdb3133a7f20c1536e0"
dependencies = [
"bitcoin",
"libc",
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-# lightning-background-processor = { git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
-lightning-background-processor = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "d4d322580994857b1222488f8467311d6db61482" }
-# lightning-background-processor = { path = "../rust-lightning/lightning-background-processor" }
+lightning = "0.0.14"
+lightning-block-sync = { version = "0.0.14", features = [ "rpc-client" ] }
+lightning-invoice = "0.5"
+lightning-net-tokio = "0.0.14"
+lightning-persister = "0.0.14"
+lightning-background-processor = "0.0.14"
+
base64 = "0.13.0"
bitcoin = "0.26"
bitcoin-bech32 = "0.7"
bech32 = "0.7"
hex = "0.3"
-# lightning = { git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
-lightning = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "d4d322580994857b1222488f8467311d6db61482" }
-# lightning = { path = "../rust-lightning/lightning" }
-
-# lightning-block-sync = { git = "https://github.com/rust-bitcoin/rust-lightning", features = ["rpc-client"], branch = "main" }
-lightning-block-sync = { git = "https://github.com/rust-bitcoin/rust-lightning", features = ["rpc-client"], rev = "d4d322580994857b1222488f8467311d6db61482" }
-# lightning-block-sync = { path = "../rust-lightning/lightning-block-sync", features = ["rpc-client"] }
-
-# lightning-invoice = { git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
-lightning-invoice = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "d4d322580994857b1222488f8467311d6db61482" }
-# lightning-invoice = { path = "../rust-lightning/lightning-invoice" }
-
-# lightning-net-tokio = { git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
-lightning-net-tokio = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "d4d322580994857b1222488f8467311d6db61482" }
-# lightning-net-tokio = { path = "../rust-lightning/lightning-net-tokio" }
-
-# lightning-persister = { git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
-lightning-persister = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "d4d322580994857b1222488f8467311d6db61482" }
-# lightning-persister = { path = "../rust-lightning/lightning-persister" }
-
time = "0.2"
rand = "0.4"
serde_json = { version = "1.0" }
tokio = { version = "1.0", features = [ "io-util", "macros", "rt", "rt-multi-thread", "sync", "net", "time" ] }
+
+[profile.release]
+panic = "abort"
+
+[profile.dev]
+panic = "abort"
let http_endpoint = HttpEndpoint::for_host(host.clone()).with_port(port);
let rpc_credentials =
base64::encode(format!("{}:{}", rpc_user.clone(), rpc_password.clone()));
- let bitcoind_rpc_client = RpcClient::new(&rpc_credentials, http_endpoint)?;
+ let mut bitcoind_rpc_client = RpcClient::new(&rpc_credentials, http_endpoint)?;
+ let _dummy = bitcoind_rpc_client
+ .call_method::<BlockchainInfo>("getblockchaininfo", &vec![])
+ .await
+ .map_err(|_| {
+ std::io::Error::new(std::io::ErrorKind::PermissionDenied,
+ "Failed to make initial call to bitcoind - please check your RPC user/password and access settings")
+ })?;
let mut fees: HashMap<Target, AtomicU32> = HashMap::new();
fees.insert(Target::Background, AtomicU32::new(253));
fees.insert(Target::Normal, AtomicU32::new(2000));
event_notifier: mpsc::Sender<()>, ldk_data_dir: String, logger: Arc<FilesystemLogger>,
network: Network,
) {
- println!("LDK startup successful. To view available commands: \"help\".\nLDK logs are available at <your-supplied-ldk-data-dir-path>/.ldk/logs");
+ println!("LDK startup successful. To view available commands: \"help\".");
+ println!("LDK logs are available at <your-supplied-ldk-data-dir-path>/.ldk/logs");
+ println!("Local Node ID is {}.", channel_manager.get_our_node_id());
let stdin = io::stdin();
print!("> ");
io::stdout().flush().unwrap(); // Without flushing, the `>` doesn't print
pub struct BlockchainInfo {
pub latest_height: usize,
pub latest_blockhash: BlockHash,
+ pub chain: String,
}
impl TryInto<BlockchainInfo> for JsonResponse {
latest_height: self.0["blocks"].as_u64().unwrap() as usize,
latest_blockhash: BlockHash::from_hex(self.0["bestblockhash"].as_str().unwrap())
.unwrap(),
+ chain: self.0["chain"].as_str().unwrap().to_string(),
})
}
}
let status = match loop_channel_manager.claim_funds(payment_preimage.unwrap()) {
true => {
println!(
- "\nEVENT: received payment from payment hash {} of {} millisatoshis",
- hex_utils::hex_str(&payment_hash.0),
- amt
- );
+ "\nEVENT: received payment from payment hash {} of {} millisatoshis",
+ hex_utils::hex_str(&payment_hash.0),
+ amt
+ );
print!("> ");
io::stdout().flush().unwrap();
HTLCStatus::Succeeded
}
};
+ // Check that the bitcoind we've connected to is running the network we expect
+ let bitcoind_chain = bitcoind_client.get_blockchain_info().await.chain;
+ if bitcoind_chain
+ != match args.network {
+ bitcoin::Network::Bitcoin => "main",
+ bitcoin::Network::Testnet => "test",
+ bitcoin::Network::Regtest => "regtest",
+ bitcoin::Network::Signet => "signet",
+ } {
+ println!(
+ "Chain argument ({}) didn't match bitcoind chain ({})",
+ args.network, bitcoind_chain
+ );
+ return;
+ }
+
// ## Setup
// Step 1: Initialize the FeeEstimator