Skip to content

Commit

Permalink
Remove async for ledger load
Browse files Browse the repository at this point in the history
  • Loading branch information
raychu86 committed Aug 24, 2022
1 parent f4965e0 commit 8462c8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions snarkos/ledger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub struct Ledger<N: Network> {

impl<N: Network> Ledger<N> {
/// Initializes a new instance of the ledger.
pub async fn load(private_key: &PrivateKey<N>) -> Result<Arc<Self>> {
pub fn load(private_key: PrivateKey<N>) -> Result<Arc<Self>> {
// Derive the view key and address.
let view_key = ViewKey::try_from(private_key)?;
let address = Address::try_from(&view_key)?;
Expand All @@ -62,7 +62,7 @@ impl<N: Network> Ledger<N> {
ledger: RwLock::new(InternalLedger::open()?),
peers: Default::default(),
server: OnceBox::new(),
private_key: *private_key,
private_key,
view_key,
address,
});
Expand All @@ -79,7 +79,7 @@ impl<N: Network> Ledger<N> {
}

/// Initializes a new instance of the ledger.
pub(super) async fn new_with_genesis(private_key: &PrivateKey<N>, genesis_block: Block<N>) -> Result<Arc<Self>> {
pub(super) fn new_with_genesis(private_key: PrivateKey<N>, genesis_block: Block<N>) -> Result<Arc<Self>> {
// Derive the view key and address.
let view_key = ViewKey::try_from(private_key)?;
let address = Address::try_from(&view_key)?;
Expand All @@ -104,7 +104,7 @@ impl<N: Network> Ledger<N> {
ledger: RwLock::new(internal_ledger),
peers: Default::default(),
server: OnceBox::new(),
private_key: *private_key,
private_key,
view_key,
address,
});
Expand Down
4 changes: 2 additions & 2 deletions snarkos/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl<N: Network, E: Environment> Node<N, E> {
let ledger = match cli.dev {
None => {
// Initialize the ledger.
let ledger = Ledger::<N>::load(account.private_key()).await?;
let ledger = Ledger::<N>::load(*account.private_key())?;
// Sync the ledger with the network.
ledger.initial_sync_with_network(&cli.beacon_addr.ip()).await?;

Expand All @@ -52,7 +52,7 @@ impl<N: Network, E: Environment> Node<N, E> {
let genesis_block = request_genesis_block::<N>(cli.beacon_addr.ip()).await?;

// Initialize the ledger from the provided genesis block.
Ledger::<N>::new_with_genesis(account.private_key(), genesis_block).await?
Ledger::<N>::new_with_genesis(*account.private_key(), genesis_block)?
}
};

Expand Down

0 comments on commit 8462c8e

Please sign in to comment.