]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Rename `BestBlock::from_genesis` to `from_network` for clarity 2023-02-no-pub-genesis-hashes
authorMatt Corallo <git@bluematt.me>
Wed, 15 Feb 2023 06:09:00 +0000 (06:09 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 24 Feb 2023 00:22:58 +0000 (00:22 +0000)
fuzz/src/chanmon_consistency.rs
fuzz/src/full_stack.rs
lightning-background-processor/src/lib.rs
lightning/src/chain/channelmonitor.rs
lightning/src/chain/mod.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_test_utils.rs

index 4386302f845b0d95279bbba99c975dede237df8a..40106ffbb86d5a9e614aa05887546cd582217a70 100644 (file)
@@ -418,7 +418,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out) {
                        let network = Network::Bitcoin;
                        let params = ChainParameters {
                                network,
-                               best_block: BestBlock::from_genesis(network),
+                               best_block: BestBlock::from_network(network),
                        };
                        (ChannelManager::new($fee_estimator.clone(), monitor.clone(), broadcast.clone(), &router, Arc::clone(&logger), keys_manager.clone(), keys_manager.clone(), keys_manager.clone(), config, params),
                        monitor, keys_manager)
index 71fb26b6a7e61eb570721eeba19489435b726347..e7d10a341629db7d5e190945e51f8e7959fc02a2 100644 (file)
@@ -442,7 +442,7 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
        let network = Network::Bitcoin;
        let params = ChainParameters {
                network,
-               best_block: BestBlock::from_genesis(network),
+               best_block: BestBlock::from_network(network),
        };
        let channelmanager = Arc::new(ChannelManager::new(fee_est.clone(), monitor.clone(), broadcast.clone(), &router, Arc::clone(&logger), keys_manager.clone(), keys_manager.clone(), keys_manager.clone(), config, params));
        // Adding new calls to `EntropySource::get_secure_random_bytes` during startup can change all the
index ce94f0107a3213e652b70275bba3543b70568854..67493c23333696b31e84e3240cc31e78369b35c5 100644 (file)
@@ -950,7 +950,7 @@ mod tests {
                        let now = Duration::from_secs(genesis_block.header.time as u64);
                        let keys_manager = Arc::new(KeysManager::new(&seed, now.as_secs(), now.subsec_nanos()));
                        let chain_monitor = Arc::new(chainmonitor::ChainMonitor::new(Some(chain_source.clone()), tx_broadcaster.clone(), logger.clone(), fee_estimator.clone(), persister.clone()));
-                       let best_block = BestBlock::from_genesis(network);
+                       let best_block = BestBlock::from_network(network);
                        let params = ChainParameters { network, best_block };
                        let manager = Arc::new(ChannelManager::new(fee_estimator.clone(), chain_monitor.clone(), tx_broadcaster.clone(), router.clone(), logger.clone(), keys_manager.clone(), keys_manager.clone(), keys_manager.clone(), UserConfig::default(), params));
                        let p2p_gossip_sync = Arc::new(P2PGossipSync::new(network_graph.clone(), Some(chain_source.clone()), logger.clone()));
index 509ebed6fbad3a6bc597838ec01b7dcb367c33f4..b2a82330916081163f441996fb0b3cfb84f5b7a1 100644 (file)
@@ -4155,7 +4155,7 @@ mod tests {
                // Prune with one old state and a holder commitment tx holding a few overlaps with the
                // old state.
                let shutdown_pubkey = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap());
-               let best_block = BestBlock::from_genesis(Network::Testnet);
+               let best_block = BestBlock::from_network(Network::Testnet);
                let monitor = ChannelMonitor::new(Secp256k1::new(), keys,
                                                  Some(ShutdownScript::new_p2wpkh_from_pubkey(shutdown_pubkey).into_inner()), 0, &Script::new(),
                                                  (OutPoint { txid: Txid::from_slice(&[43; 32]).unwrap(), index: 0 }, Script::new()),
index cd11bc337eff97593c8f3b0640f54dcd6d2bf09f..a6ed856ae4a0091124e68b78f928f7fb1c41650e 100644 (file)
@@ -40,7 +40,7 @@ pub struct BestBlock {
 impl BestBlock {
        /// Constructs a `BestBlock` that represents the genesis block at height 0 of the given
        /// network.
-       pub fn from_genesis(network: Network) -> Self {
+       pub fn from_network(network: Network) -> Self {
                BestBlock {
                        block_hash: genesis_block(network).header.block_hash(),
                        height: 0,
index e3641a6204a96d6685098a86ba6fc9d67309e15d..2b9920aa2bae50879764b632f6f071588a14f89d 100644 (file)
@@ -7175,7 +7175,7 @@ mod tests {
                let secp_ctx = Secp256k1::new();
                let seed = [42; 32];
                let network = Network::Testnet;
-               let best_block = BestBlock::from_genesis(network);
+               let best_block = BestBlock::from_network(network);
                let chain_hash = best_block.block_hash();
                let keys_provider = test_utils::TestKeysInterface::new(&seed, network);
 
index 3ee4dc2fe221df16481432315e0f1d02e2b8c087..d938e37102094679915841afb0c59c0a317a1a50 100644 (file)
@@ -8687,7 +8687,7 @@ pub mod bench {
                let keys_manager_a = KeysManager::new(&seed_a, 42, 42);
                let node_a = ChannelManager::new(&fee_estimator, &chain_monitor_a, &tx_broadcaster, &router, &logger_a, &keys_manager_a, &keys_manager_a, &keys_manager_a, config.clone(), ChainParameters {
                        network,
-                       best_block: BestBlock::from_genesis(network),
+                       best_block: BestBlock::from_network(network),
                });
                let node_a_holder = NodeHolder { node: &node_a };
 
@@ -8697,7 +8697,7 @@ pub mod bench {
                let keys_manager_b = KeysManager::new(&seed_b, 42, 42);
                let node_b = ChannelManager::new(&fee_estimator, &chain_monitor_b, &tx_broadcaster, &router, &logger_b, &keys_manager_b, &keys_manager_b, &keys_manager_b, config.clone(), ChainParameters {
                        network,
-                       best_block: BestBlock::from_genesis(network),
+                       best_block: BestBlock::from_network(network),
                });
                let node_b_holder = NodeHolder { node: &node_b };
 
@@ -8721,7 +8721,7 @@ pub mod bench {
                assert_eq!(&tx_broadcaster.txn_broadcasted.lock().unwrap()[..], &[tx.clone()]);
 
                let block = Block {
-                       header: BlockHeader { version: 0x20000000, prev_blockhash: BestBlock::from_genesis(network), merkle_root: TxMerkleNode::all_zeros(), time: 42, bits: 42, nonce: 42 },
+                       header: BlockHeader { version: 0x20000000, prev_blockhash: BestBlock::from_network(network).block_hash(), merkle_root: TxMerkleNode::all_zeros(), time: 42, bits: 42, nonce: 42 },
                        txdata: vec![tx],
                };
                Listen::block_connected(&node_a, &block, 1);
index 6274c8bf6e987af88c1be334fa715ffd7ad50ff6..2827598aa19424f6d5aaa463c74a445ba284354d 100644 (file)
@@ -2341,7 +2341,7 @@ pub fn create_node_chanmgrs<'a, 'b>(node_count: usize, cfgs: &'a Vec<NodeCfg<'b>
                let network = Network::Testnet;
                let params = ChainParameters {
                        network,
-                       best_block: BestBlock::from_genesis(network),
+                       best_block: BestBlock::from_network(network),
                };
                let node = ChannelManager::new(cfgs[i].fee_estimator, &cfgs[i].chain_monitor, cfgs[i].tx_broadcaster, &cfgs[i].router, cfgs[i].logger, cfgs[i].keys_manager,
                        cfgs[i].keys_manager, cfgs[i].keys_manager, if node_config[i].is_some() { node_config[i].clone().unwrap() } else { test_default_channel_config() }, params);