mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Proper configuration for test mining
This commit is contained in:
parent
791d2355ee
commit
eb2be99d40
2 changed files with 15 additions and 3 deletions
|
@ -52,4 +52,4 @@ mod sync;
|
|||
mod types;
|
||||
|
||||
pub use server::Server;
|
||||
pub use types::{ServerConfig, Seeding};
|
||||
pub use types::{ServerConfig, MinerConfig, Seeding};
|
||||
|
|
|
@ -41,6 +41,12 @@ fn simulate_block_propagation() {
|
|||
let mut evtlp = reactor::Core::new().unwrap();
|
||||
let handle = evtlp.handle();
|
||||
|
||||
let miner_config = grin::MinerConfig{
|
||||
enable_mining: true,
|
||||
burn_reward: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// instantiates 5 servers on different ports
|
||||
let mut servers = vec![];
|
||||
for n in 0..5 {
|
||||
|
@ -64,7 +70,7 @@ fn simulate_block_propagation() {
|
|||
}
|
||||
|
||||
// start mining
|
||||
servers[0].start_miner();
|
||||
servers[0].start_miner(miner_config);
|
||||
let original_height = servers[0].head().height;
|
||||
|
||||
// monitor for a change of head on a different server and check whether
|
||||
|
@ -84,6 +90,12 @@ fn simulate_full_sync() {
|
|||
let mut evtlp = reactor::Core::new().unwrap();
|
||||
let handle = evtlp.handle();
|
||||
|
||||
let miner_config = grin::MinerConfig{
|
||||
enable_mining: true,
|
||||
burn_reward: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// instantiates 2 servers on different ports
|
||||
let mut servers = vec![];
|
||||
for n in 0..2 {
|
||||
|
@ -98,7 +110,7 @@ fn simulate_full_sync() {
|
|||
}
|
||||
|
||||
// mine a few blocks on server 1
|
||||
servers[0].start_miner();
|
||||
servers[0].start_miner(miner_config);
|
||||
thread::sleep(time::Duration::from_secs(15));
|
||||
|
||||
// connect 1 and 2
|
||||
|
|
Loading…
Reference in a new issue