mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-05-24 08:09:52 +08:00
feat: verify that the node can produce invalid blocks but continue to mine valid blocks afterwards (simulating a transient mining bug)
This commit is contained in:
@@ -1113,6 +1113,77 @@ fn deep_contract() {
|
||||
test_observer::clear();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn bad_microblock_pubkey() {
|
||||
if env::var("BITCOIND_TEST") != Ok("1".into()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let (mut conf, _miner_account) = neon_integration_test_conf();
|
||||
|
||||
test_observer::spawn();
|
||||
|
||||
conf.events_observers.push(EventObserverConfig {
|
||||
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
|
||||
events_keys: vec![EventKeyType::AnyEvent],
|
||||
});
|
||||
|
||||
let mut btcd_controller = BitcoinCoreController::new(conf.clone());
|
||||
btcd_controller
|
||||
.start_bitcoind()
|
||||
.map_err(|_e| ())
|
||||
.expect("Failed starting bitcoind");
|
||||
|
||||
let burnchain_config = Burnchain::regtest(&conf.get_burn_db_path());
|
||||
|
||||
let mut btc_regtest_controller = BitcoinRegtestController::with_burnchain(
|
||||
conf.clone(),
|
||||
None,
|
||||
Some(burnchain_config.clone()),
|
||||
None,
|
||||
);
|
||||
|
||||
btc_regtest_controller.bootstrap_chain(201);
|
||||
|
||||
eprintln!("Chain bootstrapped...");
|
||||
|
||||
let mut run_loop = neon::RunLoop::new(conf.clone());
|
||||
let blocks_processed = run_loop.get_blocks_processed_arc();
|
||||
let _client = reqwest::blocking::Client::new();
|
||||
let channel = run_loop.get_coordinator_channel().unwrap();
|
||||
|
||||
thread::spawn(move || run_loop.start(Some(burnchain_config), 0));
|
||||
|
||||
// give the run loop some time to start up!
|
||||
wait_for_runloop(&blocks_processed);
|
||||
|
||||
// first block wakes up the run loop
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
|
||||
// first block will hold our VRF registration
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
|
||||
// second block will be the first mined Stacks block
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
|
||||
// fault injection
|
||||
env::set_var("STACKS_MICROBLOCK_PUBKEY_HASH", "0000000000000000000000000000000000000000");
|
||||
for _i in 0..10 {
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
}
|
||||
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
|
||||
let blocks = test_observer::get_blocks();
|
||||
assert!(blocks.len() <= 3);
|
||||
|
||||
channel.stop_chains_coordinator();
|
||||
test_observer::clear();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn liquid_ustx_integration() {
|
||||
|
||||
Reference in New Issue
Block a user