Major refactoring. Changed mining algorithm to Blakeout. Changed keypair mining algorithm.

This commit is contained in:
Revertron
2021-03-10 22:21:50 +01:00
parent 5c2373b40d
commit 5d57473122
23 changed files with 824 additions and 713 deletions
+6 -7
View File
@@ -1,20 +1,19 @@
use crate::{Blockchain, Bus, Keystore};
use crate::{Chain, Bus, Keystore, Settings};
use crate::event::Event;
use crate::settings::Settings;
#[allow(unused_imports)]
use log::{trace, debug, info, warn, error};
pub struct Context {
pub settings: Settings,
pub keystore: Keystore,
pub blockchain: Blockchain,
pub chain: Chain,
pub bus: Bus<Event>,
}
impl Context {
/// Creating an essential context to work with
pub fn new(settings: Settings, keystore: Keystore, blockchain: Blockchain) -> Context {
Context { settings, keystore, blockchain, bus: Bus::new() }
pub fn new(settings: Settings, keystore: Keystore, chain: Chain) -> Context {
Context { settings, keystore, chain, bus: Bus::new() }
}
/// Load keystore and return Context
@@ -39,7 +38,7 @@ impl Context {
self.keystore = keystore;
}
pub fn get_blockchain(&self) -> &Blockchain {
&self.blockchain
pub fn get_chain(&self) -> &Chain {
&self.chain
}
}