bump to ldk 118
authorJohn Cantrell <johncantrell@tbd.email>
Tue, 5 Dec 2023 21:42:47 +0000 (16:42 -0500)
committerJohn Cantrell <johncantrell@tbd.email>
Tue, 5 Dec 2023 21:53:47 +0000 (16:53 -0500)
Cargo.toml
src/lib.rs
src/serialization.rs
src/tests/mod.rs
src/verifier.rs

index f6d05157d9d1bd2c934b35d8b1408c344024569a..7e6ce0fd110c154d56705a93de8940cb199a9e71 100644 (file)
@@ -5,16 +5,16 @@ edition = "2021"
 
 [dependencies]
 bitcoin = "0.29"
-lightning = { version = "0.0.117" }
-lightning-block-sync = { version = "0.0.117", features=["rest-client"] }
-lightning-net-tokio = { version = "0.0.117" }
+lightning = { version = "0.0.118" }
+lightning-block-sync = { version = "0.0.118", features=["rest-client"] }
+lightning-net-tokio = { version = "0.0.118" }
 tokio = { version = "1.25", features = ["full"] }
 tokio-postgres = { version = "=0.7.5" }
 futures = "0.3"
 
 [dev-dependencies]
-lightning = { version = "0.0.117", features = ["_test_utils"] }
-lightning-rapid-gossip-sync = { version = "0.0.117" }
+lightning = { version = "0.0.118", features = ["_test_utils"] }
+lightning-rapid-gossip-sync = { version = "0.0.118" }
 
 [profile.dev]
 panic = "abort"
index 1852911a68a02b18e32bc7bc2a4a7c86d9b1b667..25d13089f4ab8459dccb6099fdefda49f2e05b46 100644 (file)
@@ -14,6 +14,7 @@ use std::fs::File;
 use std::io::BufReader;
 use std::ops::Deref;
 use std::sync::Arc;
+use bitcoin::blockdata::constants::ChainHash;
 use lightning::log_info;
 
 use lightning::routing::gossip::{NetworkGraph, NodeId};
@@ -157,8 +158,7 @@ fn serialize_empty_blob(current_timestamp: u64) -> Vec<u8> {
        let mut blob = GOSSIP_PREFIX.to_vec();
 
        let network = config::network();
-       let genesis_block = bitcoin::blockdata::constants::genesis_block(network);
-       let chain_hash = genesis_block.block_hash();
+       let chain_hash = ChainHash::using_genesis_block(network);
        chain_hash.write(&mut blob).unwrap();
 
        let blob_timestamp = Snapshotter::<Arc<RGSSLogger>>::round_down_to_nearest_multiple(current_timestamp, SYMLINK_GRANULARITY_INTERVAL as u64) as u32;
index 7e58b02e5d587a8a2e63a3e41712ac67feb17770..0119ea3b79a66875e94eb91db4e29e46e68d668b 100644 (file)
@@ -2,8 +2,8 @@ use std::cmp::max;
 use std::collections::HashMap;
 use std::time::{SystemTime, UNIX_EPOCH};
 
-use bitcoin::BlockHash;
-use bitcoin::hashes::Hash;
+use bitcoin::Network;
+use bitcoin::blockdata::constants::ChainHash;
 use lightning::ln::msgs::{UnsignedChannelAnnouncement, UnsignedChannelUpdate};
 use lightning::util::ser::{BigSize, Writeable};
 use crate::config;
@@ -15,7 +15,7 @@ pub(super) struct SerializationSet {
        pub(super) updates: Vec<UpdateSerialization>,
        pub(super) full_update_defaults: DefaultUpdateValues,
        pub(super) latest_seen: u32,
-       pub(super) chain_hash: BlockHash,
+       pub(super) chain_hash: ChainHash,
 }
 
 pub(super) struct DefaultUpdateValues {
@@ -109,7 +109,7 @@ pub(super) fn serialize_delta_set(delta_set: DeltaSet, last_sync_timestamp: u32)
                announcements: vec![],
                updates: vec![],
                full_update_defaults: Default::default(),
-               chain_hash: BlockHash::all_zeros(),
+               chain_hash: ChainHash::using_genesis_block(Network::Bitcoin),
                latest_seen: 0,
        };
 
@@ -140,7 +140,7 @@ pub(super) fn serialize_delta_set(delta_set: DeltaSet, last_sync_timestamp: u32)
                let channel_announcement_delta = channel_delta.announcement.as_ref().unwrap();
                if !chain_hash_set {
                        chain_hash_set = true;
-                       serialization_set.chain_hash = channel_announcement_delta.announcement.chain_hash.clone();
+                       serialization_set.chain_hash = channel_announcement_delta.announcement.chain_hash;
                }
 
                let current_announcement_seen = channel_announcement_delta.seen;
index dfc7ce466ec7d5c7ce2634650b419125a7813e03..42de18a4fb63f7aea2ec4a3a19f34b393a26dc07 100644 (file)
@@ -4,7 +4,8 @@ use std::cell::RefCell;
 use std::sync::Arc;
 use std::{fs, thread};
 use std::time::{SystemTime, UNIX_EPOCH};
-use bitcoin::{BlockHash, Network};
+use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::Network;
 use bitcoin::secp256k1::ecdsa::Signature;
 use bitcoin::secp256k1::{Secp256k1, SecretKey};
 use bitcoin::hashes::Hash;
@@ -31,8 +32,8 @@ fn blank_signature() -> Signature {
        Signature::from_compact(&[0u8; 64]).unwrap()
 }
 
-fn genesis_hash() -> BlockHash {
-       bitcoin::blockdata::constants::genesis_block(Network::Bitcoin).block_hash()
+fn genesis_hash() -> ChainHash {
+       ChainHash::using_genesis_block(Network::Bitcoin)
 }
 
 fn current_time() -> u32 {
index 6813ff7d3dd766da51d0ae23779e27f2ea8c76de..5e912446d3a219ad22f8363a3b329a254f45cbb9 100644 (file)
@@ -3,6 +3,7 @@ use std::ops::Deref;
 use std::sync::Arc;
 use std::sync::Mutex;
 
+use bitcoin::blockdata::constants::ChainHash;
 use bitcoin::{BlockHash, TxOut};
 use bitcoin::blockdata::block::Block;
 use bitcoin::hashes::Hash;
@@ -84,7 +85,7 @@ impl<L: Deref + Clone + Send + Sync + 'static> ChainVerifier<L> where L::Target:
 }
 
 impl<L: Deref + Clone + Send + Sync + 'static> UtxoLookup for ChainVerifier<L> where L::Target: Logger {
-       fn get_utxo(&self, _genesis_hash: &BlockHash, short_channel_id: u64) -> UtxoResult {
+       fn get_utxo(&self, _genesis_hash: &ChainHash, short_channel_id: u64) -> UtxoResult {
                let res = UtxoFuture::new();
                let fut = res.clone();
                let graph_ref = Arc::clone(&self.graph);