From 8462c8e2633945cccca05c9e21c51e6f7d91566e Mon Sep 17 00:00:00 2001 From: raychu86 <14917648+raychu86@users.noreply.github.com> Date: Wed, 24 Aug 2022 15:30:05 -0700 Subject: [PATCH] Remove async for ledger load --- snarkos/ledger/mod.rs | 8 ++++---- snarkos/node.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/snarkos/ledger/mod.rs b/snarkos/ledger/mod.rs index 9a4cfdd808..e320ba20fc 100644 --- a/snarkos/ledger/mod.rs +++ b/snarkos/ledger/mod.rs @@ -52,7 +52,7 @@ pub struct Ledger { impl Ledger { /// Initializes a new instance of the ledger. - pub async fn load(private_key: &PrivateKey) -> Result> { + pub fn load(private_key: PrivateKey) -> Result> { // Derive the view key and address. let view_key = ViewKey::try_from(private_key)?; let address = Address::try_from(&view_key)?; @@ -62,7 +62,7 @@ impl Ledger { ledger: RwLock::new(InternalLedger::open()?), peers: Default::default(), server: OnceBox::new(), - private_key: *private_key, + private_key, view_key, address, }); @@ -79,7 +79,7 @@ impl Ledger { } /// Initializes a new instance of the ledger. - pub(super) async fn new_with_genesis(private_key: &PrivateKey, genesis_block: Block) -> Result> { + pub(super) fn new_with_genesis(private_key: PrivateKey, genesis_block: Block) -> Result> { // Derive the view key and address. let view_key = ViewKey::try_from(private_key)?; let address = Address::try_from(&view_key)?; @@ -104,7 +104,7 @@ impl Ledger { ledger: RwLock::new(internal_ledger), peers: Default::default(), server: OnceBox::new(), - private_key: *private_key, + private_key, view_key, address, }); diff --git a/snarkos/node.rs b/snarkos/node.rs index 69ccc849a2..0db5a7a871 100644 --- a/snarkos/node.rs +++ b/snarkos/node.rs @@ -39,7 +39,7 @@ impl Node { let ledger = match cli.dev { None => { // Initialize the ledger. - let ledger = Ledger::::load(account.private_key()).await?; + let ledger = Ledger::::load(*account.private_key())?; // Sync the ledger with the network. ledger.initial_sync_with_network(&cli.beacon_addr.ip()).await?; @@ -52,7 +52,7 @@ impl Node { let genesis_block = request_genesis_block::(cli.beacon_addr.ip()).await?; // Initialize the ledger from the provided genesis block. - Ledger::::new_with_genesis(account.private_key(), genesis_block).await? + Ledger::::new_with_genesis(*account.private_key(), genesis_block)? } };