Skip to content
Permalink
Browse files

add multisig value in initial total value check

  • Loading branch information...
vincenthz committed May 11, 2019
1 parent ad18431 commit bb2a8ee4f2966bd90815b947c09e15d5a734cc6f
Showing with 11 additions and 2 deletions.
  1. +6 −1 chain-impl-mockchain/src/ledger.rs
  2. +5 −1 chain-impl-mockchain/src/multisig/ledger.rs
@@ -488,9 +488,14 @@ impl Ledger {
.accounts
.get_total_value()
.map_err(|_| Error::Block0(Block0Error::UtxoTotalValueTooBig))?;
let multisig_value = self
.multisig
.get_total_value()
.map_err(|_| Error::Block0(Block0Error::UtxoTotalValueTooBig))?;
let all_utxo_values = old_utxo_values
.chain(new_utxo_values)
.chain(Some(account_value));
.chain(Some(account_value))
.chain(Some(multisig_value));
Value::sum(all_utxo_values)
.map_err(|_| Error::Block0(Block0Error::UtxoTotalValueTooBig))?;
Ok(())
@@ -3,7 +3,7 @@ use std::collections::hash_map::DefaultHasher;

use super::declaration::{Declaration, DeclarationError, Identifier};
use crate::accounting::account::{self, SpendingCounter};
use crate::value::Value;
use crate::value::{Value, ValueError};

#[derive(Clone)]
pub struct Ledger {
@@ -113,4 +113,8 @@ impl Ledger {
spending_counter,
))
}

pub fn get_total_value(&self) -> Result<Value, ValueError> {
self.accounts.get_total_value()
}
}

0 comments on commit bb2a8ee

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