# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-lightning = { version = "0.0.101" }
-lightning-block-sync = { version = "0.0.101", features = [ "rpc-client" ] }
-lightning-invoice = { version = "0.9.0" }
-lightning-net-tokio = { version = "0.0.101" }
-lightning-persister = { version = "0.0.101" }
-lightning-background-processor = { version = "0.0.101" }
+lightning = { version = "0.0.102" }
+lightning-block-sync = { version = "0.0.102", features = [ "rpc-client" ] }
+lightning-invoice = { version = "0.10.0" }
+lightning-net-tokio = { version = "0.0.102" }
+lightning-persister = { version = "0.0.102" }
+lightning-background-processor = { version = "0.0.102" }
base64 = "0.13.0"
bitcoin = "0.27"
use lightning::routing::network_graph::NetGraphMsgHandler;
use lightning::routing::router;
use lightning::routing::router::RouteHint;
+use lightning::routing::scorer::Scorer;
use lightning::util::config::{ChannelConfig, ChannelHandshakeLimits, UserConfig};
use lightning_invoice::{utils, Currency, Invoice};
use std::env;
amt_msat,
final_cltv,
logger,
+ &Scorer::default(),
);
if let Err(e) = route {
println!("ERROR: failed to find route: {}", e.err);
}
let status = match channel_manager.send_payment(&route.unwrap(), payment_hash, &payment_secret)
{
- Ok(()) => {
+ Ok(_payment_id) => {
println!("EVENT: initiated sending {} msats to {}", amt_msat, payee);
HTLCStatus::Pending
}
amt_msat,
40,
logger,
+ &Scorer::default(),
) {
Ok(r) => r,
Err(e) => {
};
let mut payments = payment_storage.lock().unwrap();
- let payment_hash = channel_manager.send_spontaneous_payment(&route, None).unwrap();
+ let payment_hash = channel_manager.send_spontaneous_payment(&route, None).unwrap().0;
payments.insert(
payment_hash,
PaymentInfo {
use bitcoin::blockdata::constants::genesis_block;
use bitcoin::blockdata::transaction::Transaction;
use bitcoin::consensus::encode;
-use bitcoin::hashes::sha256::Hash as Sha256;
-use bitcoin::hashes::Hash;
use bitcoin::network::constants::Network;
use bitcoin::secp256k1::Secp256k1;
use bitcoin::BlockHash;
}
}
}
- Event::PaymentSent { payment_preimage } => {
- let hashed = PaymentHash(Sha256::hash(&payment_preimage.0).into_inner());
+ Event::PaymentSent { payment_preimage, payment_hash } => {
let mut payments = outbound_payments.lock().unwrap();
- for (payment_hash, payment) in payments.iter_mut() {
- if *payment_hash == hashed {
+ for (hash, payment) in payments.iter_mut() {
+ if *hash == *payment_hash {
payment.preimage = Some(*payment_preimage);
payment.status = HTLCStatus::Succeeded;
println!(
network_update: _,
all_paths_failed,
path: _,
+ short_channel_id,
} => {
print!(
- "\nEVENT: Failed to send payment{} to payment hash {:?}: ",
+ "\nEVENT: Failed to send payment{} to payment hash {:?}",
if *all_paths_failed { "" } else { " along MPP path" },
hex_utils::hex_str(&payment_hash.0)
);
+ if let Some(scid) = short_channel_id {
+ print!(" because of failure at channel {}", scid);
+ }
if *rejected_by_dest {
- println!("re-attempting the payment will not succeed");
+ println!(": re-attempting the payment will not succeed");
} else {
- println!("payment may be retried");
+ println!(": payment may be retried");
}
print!("> ");
io::stdout().flush().unwrap();
.unwrap();
bitcoind_client.broadcast_transaction(&spending_tx);
}
- Event::ChannelClosed { channel_id, reason } => {
+ Event::ChannelClosed { channel_id, reason, user_channel_id: _ } => {
println!(
"\nEVENT: Channel {} closed due to: {:?}",
hex_utils::hex_str(channel_id),
print!("> ");
io::stdout().flush().unwrap();
}
+ Event::DiscardFunding { .. } => {
+ // A "real" node should probably "lock" the UTXOs spent in funding transactions until
+ // the funding transaction either confirms, or this event is generated.
+ }
}
}