edition = "2021"
[dependencies]
-bitcoin = "0.30"
-hex-conservative = "0.2"
-lightning = { version = "0.0.123" }
-lightning-block-sync = { version = "0.0.123", features=["rest-client"] }
-lightning-net-tokio = { version = "0.0.123" }
+bitcoin = "0.32.2"
+hex-conservative = "0.2.1"
+lightning = { version = "0.0.124" }
+lightning-block-sync = { version = "0.0.124", features=["rest-client"] }
+lightning-net-tokio = { version = "0.0.124" }
tokio = { version = "1.25", features = ["full"] }
tokio-postgres = { version = "=0.7.5" }
futures = "0.3"
[dev-dependencies]
-lightning = { version = "0.0.123", features = ["_test_utils"] }
-lightning-rapid-gossip-sync = { version = "0.0.123" }
+lightning = { version = "0.0.124", features = ["_test_utils"] }
+lightning-rapid-gossip-sync = { version = "0.0.124" }
[profile.dev]
panic = "abort"
use crate::hex_utils;
use std::env;
-use std::io::Cursor;
use std::net::{SocketAddr, ToSocketAddrs};
use std::time::Duration;
+use bitcoin::io::Cursor;
use bitcoin::Network;
use bitcoin::hashes::hex::FromHex;
use bitcoin::secp256k1::PublicKey;
let announcement: Vec<u8> = row.get("announcement_signed");
let tx_ref = &tx;
updates.push(async move {
- let scid = ChannelAnnouncement::read(&mut Cursor::new(announcement)).unwrap().contents.short_channel_id as i64;
+ let scid = ChannelAnnouncement::read(&mut Cursor::new(&announcement)).unwrap().contents.short_channel_id as i64;
assert!(scid > 0); // Will roll over in some 150 years or so
tx_ref.execute("UPDATE channel_announcements SET short_channel_id = $1 WHERE id = $2", &[&scid, &id]).await.unwrap();
});
use std::collections::{BTreeMap, HashMap, HashSet};
-use std::io::Cursor;
use std::ops::Deref;
use std::sync::Arc;
use std::time::{Instant, SystemTime, UNIX_EPOCH};
+use bitcoin::io::Cursor;
+
use lightning::ln::msgs::{ChannelAnnouncement, ChannelUpdate, NodeAnnouncement, SocketAddress, UnsignedChannelAnnouncement, UnsignedChannelUpdate};
use lightning::routing::gossip::{NetworkGraph, NodeId};
use lightning::util::ser::Readable;
while let Some(row_res) = pinned_rows.next().await {
let current_announcement_row = row_res.unwrap();
let blob: Vec<u8> = current_announcement_row.get("announcement_signed");
- let mut readable = Cursor::new(blob);
+ let mut readable = Cursor::new(&blob);
let unsigned_announcement = ChannelAnnouncement::read(&mut readable).unwrap().contents;
let scid = unsigned_announcement.short_channel_id;
if seen < reminder_threshold_timestamp as u32 {
let blob: Vec<u8> = current_row.get("blob_signed");
- let mut readable = Cursor::new(blob);
+ let mut readable = Cursor::new(&blob);
let unsigned_channel_update = ChannelUpdate::read(&mut readable).unwrap().contents;
let scid = unsigned_channel_update.short_channel_id;
let direction: bool = current_reference.get("direction");
let seen = current_reference.get::<_, i64>("seen") as u32;
let blob: Vec<u8> = current_reference.get("blob_signed");
- let mut readable = Cursor::new(blob);
+ let mut readable = Cursor::new(&blob);
let unsigned_channel_update = ChannelUpdate::read(&mut readable).unwrap().contents;
let scid = unsigned_channel_update.short_channel_id;
let direction: bool = intermediate_update.get("direction");
let current_seen_timestamp = intermediate_update.get::<_, i64>("seen") as u32;
let blob: Vec<u8> = intermediate_update.get("blob_signed");
- let mut readable = Cursor::new(blob);
+ let mut readable = Cursor::new(&blob);
let unsigned_channel_update = ChannelUpdate::read(&mut readable).unwrap().contents;
let scid = unsigned_channel_update.short_channel_id;
// determine mutations
if let Some(last_seen_update) = update_delta.last_update_before_seen.as_ref() {
- if unsigned_channel_update.flags != last_seen_update.update.flags {
+ if unsigned_channel_update.channel_flags != last_seen_update.update.channel_flags {
update_delta.mutated_properties.flags = true;
}
if unsigned_channel_update.cltv_expiry_delta != last_seen_update.update.cltv_expiry_delta {
let seen = current_reference.get::<_, i64>("seen") as u32;
let blob: Vec<u8> = current_reference.get("announcement_signed");
- let mut readable = Cursor::new(blob);
+ let mut readable = Cursor::new(&blob);
let unsigned_node_announcement = NodeAnnouncement::read(&mut readable).unwrap().contents;
let node_id = unsigned_node_announcement.node_id;
let current_seen_timestamp = intermediate_update.get::<_, i64>("seen") as u32;
let blob: Vec<u8> = intermediate_update.get("announcement_signed");
- let mut readable = Cursor::new(blob);
+ let mut readable = Cursor::new(&blob);
let unsigned_node_announcement = NodeAnnouncement::read(&mut readable).unwrap().contents;
let node_id = unsigned_node_announcement.node_id;