Skip to content

Commit

Permalink
need the Clone trait on the Update objects in chain
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasDP committed Feb 14, 2019
1 parent e6fcb57 commit a1c9b90
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/blockchain/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ impl Blockchain<Mockchain> {
}
}

impl<B: BlockConfig> Blockchain<B> {
impl<B: BlockConfig> Blockchain<B>
where
<B::Ledger as property::Ledger>::Update: Clone,
<B::Settings as property::Settings>::Update: Clone,
<B::Leader as property::LeaderSelection>::Update: Clone,
{
pub fn handle_incoming_block(&mut self, block: B::Block) -> Result<(), storage::Error> {
use chain_core::property::Block;
let block_hash = block.id();
Expand Down Expand Up @@ -128,9 +133,9 @@ impl<B: BlockConfig> Blockchain<B> {
let ledger_diff = self.ledger.diff(block.transactions()).unwrap();
let setting_diff = self.settings.diff(&block).unwrap();

self.leadership.apply(leadership_diff).unwrap();
self.ledger.apply(ledger_diff).unwrap();
self.settings.apply(setting_diff).unwrap();
self.leadership.apply(leadership_diff.clone()).unwrap();
self.ledger.apply(ledger_diff.clone()).unwrap();
self.settings.apply(setting_diff.clone()).unwrap();

self.change_log
.push((leadership_diff, ledger_diff, setting_diff));
Expand Down

0 comments on commit a1c9b90

Please sign in to comment.