Skip to content

Commit 87a9b99

Browse files
committed
Rename MicroSPVClient::init to new
1 parent b652f9e commit 87a9b99

File tree

1 file changed

+8
-8
lines changed
  • lightning-block-sync/src

1 file changed

+8
-8
lines changed

lightning-block-sync/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ impl<P: Poll, CL: ChainListener> MicroSPVClient<P, CL> {
447447
/// useful when you have a block source which is more censorship-resistant than others but
448448
/// which only provides headers. In this case, we can use such source(s) to learn of a censorship
449449
/// attack without giving up privacy by querying a privacy-losing block sources.
450-
pub fn init(chain_tip: ValidatedBlockHeader, chain_poller: P, chain_listener: CL) -> Self {
450+
pub fn new(chain_tip: ValidatedBlockHeader, chain_poller: P, chain_listener: CL) -> Self {
451451
let header_cache = HeaderCache::new();
452452
let chain_notifier = ChainNotifier { header_cache };
453453
Self { chain_tip, chain_poller, chain_notifier, chain_listener }
@@ -503,7 +503,7 @@ mod spv_client_tests {
503503
let best_tip = chain.at_height(1);
504504

505505
let poller = poller::ChainPoller::new(&mut chain as &mut dyn BlockSource, Network::Testnet);
506-
let mut client = MicroSPVClient::init(best_tip, poller, NullChainListener {});
506+
let mut client = MicroSPVClient::new(best_tip, poller, NullChainListener {});
507507
match client.poll_best_tip().await {
508508
Err(e) => assert_eq!(e, BlockSourceError::Persistent),
509509
Ok(_) => panic!("Expected error"),
@@ -517,7 +517,7 @@ mod spv_client_tests {
517517
let common_tip = chain.tip();
518518

519519
let poller = poller::ChainPoller::new(&mut chain as &mut dyn BlockSource, Network::Testnet);
520-
let mut client = MicroSPVClient::init(common_tip, poller, NullChainListener {});
520+
let mut client = MicroSPVClient::new(common_tip, poller, NullChainListener {});
521521
match client.poll_best_tip().await {
522522
Err(e) => panic!("Unexpected error: {:?}", e),
523523
Ok((chain_tip, blocks_connected)) => {
@@ -535,7 +535,7 @@ mod spv_client_tests {
535535
let old_tip = chain.at_height(1);
536536

537537
let poller = poller::ChainPoller::new(&mut chain as &mut dyn BlockSource, Network::Testnet);
538-
let mut client = MicroSPVClient::init(old_tip, poller, NullChainListener {});
538+
let mut client = MicroSPVClient::new(old_tip, poller, NullChainListener {});
539539
match client.poll_best_tip().await {
540540
Err(e) => panic!("Unexpected error: {:?}", e),
541541
Ok((chain_tip, blocks_connected)) => {
@@ -553,7 +553,7 @@ mod spv_client_tests {
553553
let old_tip = chain.at_height(1);
554554

555555
let poller = poller::ChainPoller::new(&mut chain as &mut dyn BlockSource, Network::Testnet);
556-
let mut client = MicroSPVClient::init(old_tip, poller, NullChainListener {});
556+
let mut client = MicroSPVClient::new(old_tip, poller, NullChainListener {});
557557
match client.poll_best_tip().await {
558558
Err(e) => panic!("Unexpected error: {:?}", e),
559559
Ok((chain_tip, blocks_connected)) => {
@@ -571,7 +571,7 @@ mod spv_client_tests {
571571
let old_tip = chain.at_height(1);
572572

573573
let poller = poller::ChainPoller::new(&mut chain as &mut dyn BlockSource, Network::Testnet);
574-
let mut client = MicroSPVClient::init(old_tip, poller, NullChainListener {});
574+
let mut client = MicroSPVClient::new(old_tip, poller, NullChainListener {});
575575
match client.poll_best_tip().await {
576576
Err(e) => panic!("Unexpected error: {:?}", e),
577577
Ok((chain_tip, blocks_connected)) => {
@@ -590,7 +590,7 @@ mod spv_client_tests {
590590
let worse_tip = chain.tip();
591591

592592
let poller = poller::ChainPoller::new(&mut chain as &mut dyn BlockSource, Network::Testnet);
593-
let mut client = MicroSPVClient::init(best_tip, poller, NullChainListener {});
593+
let mut client = MicroSPVClient::new(best_tip, poller, NullChainListener {});
594594
match client.poll_best_tip().await {
595595
Err(e) => panic!("Unexpected error: {:?}", e),
596596
Ok((chain_tip, blocks_connected)) => {
@@ -999,7 +999,7 @@ mod tests {
999999
let mut source_two = &chain_two;
10001000
let mut source_three = &header_chain;
10011001
let mut source_four = &backup_chain;
1002-
let mut client = MicroSPVClient::init(
1002+
let mut client = MicroSPVClient::new(
10031003
(&chain_one).get_header(&block_1a_hash, Some(1)).await.unwrap().validate(block_1a_hash).unwrap(),
10041004
poller::ChainMultiplexer::new(
10051005
vec![&mut source_one as &mut dyn BlockSource, &mut source_two as &mut dyn BlockSource, &mut source_three as &mut dyn BlockSource],

0 commit comments

Comments
 (0)