Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Commit

Permalink
Support non-AVVM balances
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Sep 27, 2018
1 parent 9691ca9 commit caed699
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion cardano/src/block/verify_chain.rs
Expand Up @@ -6,6 +6,7 @@ use coin;
use tx::{self, TxAux, TxoPointer, TxOut, TxInWitness};
use std::collections::BTreeMap;
use fee::{self, FeeAlgorithm};
use hash;

pub struct ChainState {
// FIXME: maybe we should just keep a ref to GenesisData? Though
Expand Down Expand Up @@ -38,7 +39,13 @@ impl ChainState {
TxOut { address, value: value.clone() });
}

// FIXME: implement non_avvm_balances.
// Create utxos from non-AVVM balances.
for (address, value) in &genesis_data.non_avvm_balances {
let id = hash::Blake2b256::new(&cbor!(&address).unwrap());
utxos.insert(
TxoPointer { id, index: 0 },
TxOut { address: address.clone(), value: value.clone() });
}

ChainState {
protocol_magic: genesis_data.protocol_magic,
Expand Down
3 changes: 2 additions & 1 deletion cardano/src/config.rs
Expand Up @@ -10,6 +10,7 @@ use block;
use fee;
use coin;
use redeem;
use address;
use std::collections::BTreeMap;

/// this is the protocol magic number
Expand Down Expand Up @@ -108,5 +109,5 @@ pub struct GenesisData {
pub protocol_magic: ProtocolMagic,
pub fee_policy: fee::LinearFee,
pub avvm_distr: BTreeMap<redeem::PublicKey, coin::Coin>, // AVVM = Ada Voucher Vending Machine
pub non_avvm_balances: BTreeMap<String, coin::Coin>,
pub non_avvm_balances: BTreeMap<address::ExtendedAddr, coin::Coin>,
}

0 comments on commit caed699

Please sign in to comment.