Skip to content
Permalink
Browse files

start implementing the content apply loop

  • Loading branch information...
vincenthz committed Mar 12, 2019
1 parent 2a6ddc0 commit 2fc6c73301c70ac9cfe241f625d4af3d0e6193b8
Showing with 13 additions and 3 deletions.
  1. +1 −0 chain-impl-mockchain/src/account.rs
  2. +12 −3 chain-impl-mockchain/src/state.rs
@@ -133,6 +133,7 @@ pub struct SpendingWitness {
}

/// The public ledger of all accounts associated with their current state
#[derive(Clone)]
pub struct Ledger(Hamt<DefaultHasher, Identifier, State>);

impl Ledger {
@@ -1,7 +1,7 @@
//! The global ledger/update/delegation states
//!

use crate::block::BlockContents;
use crate::block::{BlockContents, Message};
use crate::{account, leadership, setting, utxo};
use cardano::address::Addr as OldAddress;
use chain_addr::Address;
@@ -16,6 +16,7 @@ pub(crate) type Leadership = Box<
>,
>;

#[derive(Clone)]
pub struct Ledger {
pub(crate) utxos: utxo::Ledger<Address>,
pub(crate) oldutxos: utxo::Ledger<OldAddress>,
@@ -32,7 +33,15 @@ type Error = ();

impl State {
pub fn apply(&self, contents: BlockContents) -> Result<State, Error> {
for content in contents.iter() {}
unimplemented!()
// for now we just clone ledger, since leadership is still inside the state.
let mut newst = self.ledger.clone();
for content in contents.iter() {
match content {
Message::Transaction(signed_transaction) => {}
Message::Update(update_proposal) => {}
_ => {}
}
}
unimplemented!();
}
}

0 comments on commit 2fc6c73

Please sign in to comment.
You can’t perform that action at this time.