mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-24 03:45:38 +08:00
use neon_integrations::get_pox_info
This commit is contained in:
@@ -44,7 +44,6 @@ use crate::stacks_common::util::hash::{bytes_to_hex, hex_bytes};
|
||||
|
||||
use stacks_common::types::chainstate::BlockHeaderHash;
|
||||
use stacks_common::types::chainstate::BurnchainHeaderHash;
|
||||
use stacks_common::types::chainstate::StacksBlockId;
|
||||
use stacks_common::types::chainstate::VRFSeed;
|
||||
use stacks_common::types::PrivateKey;
|
||||
use stacks_common::util::hash::Hash160;
|
||||
@@ -61,7 +60,6 @@ use stacks::clarity_cli::vm_execute as execute;
|
||||
use clarity::vm::types::{PrincipalData, QualifiedContractIdentifier};
|
||||
use clarity::vm::ClarityVersion;
|
||||
use stacks::core::BURNCHAIN_TX_SEARCH_WINDOW;
|
||||
use stacks::net::RPCPoxInfoData;
|
||||
|
||||
use crate::burnchains::bitcoin_regtest_controller::UTXO;
|
||||
use crate::neon_node::StacksNode;
|
||||
@@ -4752,38 +4750,10 @@ fn test_v1_pox_default_contract() {
|
||||
// second block will be the first mined Stacks block
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
|
||||
let (sort_db, _burn_db) = btc_regtest_controller
|
||||
.get_burnchain()
|
||||
.open_db(false)
|
||||
.unwrap();
|
||||
|
||||
info!(
|
||||
"advance to epoch_2_1 {} finished. btc height {}",
|
||||
epoch_2_1,
|
||||
_burn_db.get_canonical_chain_tip().unwrap().block_height
|
||||
);
|
||||
let (tip_consensus_hash, tip_block_bhh) =
|
||||
SortitionDB::get_canonical_stacks_chain_tip_hash(sort_db.conn()).unwrap();
|
||||
let tip = StacksBlockId::new(&tip_consensus_hash, &tip_block_bhh);
|
||||
let (mut chainstate, _) = StacksChainState::open(
|
||||
false,
|
||||
conf.burnchain.chain_id,
|
||||
&conf.get_chainstate_path_str(),
|
||||
None,
|
||||
)
|
||||
.unwrap();
|
||||
info!("advance to epoch_2_1 (height {}) finished.", epoch_2_1,);
|
||||
|
||||
// pre-v1_unlock_height means POX-1
|
||||
match RPCPoxInfoData::from_db(&sort_db, &mut chainstate, &tip, &burnchain_config) {
|
||||
Ok(pox_info) => {
|
||||
let mut parts = pox_info.contract_id.split('.');
|
||||
parts.next();
|
||||
assert_eq!("pox", parts.next().unwrap())
|
||||
}
|
||||
Err(_e) => {
|
||||
assert!(false)
|
||||
}
|
||||
}
|
||||
assert_eq!("pox", contract_name_from_get_pox_info(&conf));
|
||||
|
||||
// advance the chain to v1_unlock_height
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
@@ -4792,15 +4762,14 @@ fn test_v1_pox_default_contract() {
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
|
||||
// post-v1_unlock_height means POX-2
|
||||
match RPCPoxInfoData::from_db(&sort_db, &mut chainstate, &tip, &burnchain_config) {
|
||||
Ok(pox_info) => {
|
||||
let mut parts = pox_info.contract_id.split('.');
|
||||
parts.next();
|
||||
assert_eq!("pox-2", parts.next().unwrap())
|
||||
}
|
||||
Err(_e) => {
|
||||
assert!(false)
|
||||
}
|
||||
assert_eq!("pox-2", contract_name_from_get_pox_info(&conf));
|
||||
|
||||
fn contract_name_from_get_pox_info(conf: &Config) -> String {
|
||||
let http_origin = format!("http://{}", &conf.node.rpc_bind);
|
||||
let pox_info = neon_integrations::get_pox_info(&http_origin);
|
||||
let mut parts = pox_info.contract_id.split('.');
|
||||
parts.next();
|
||||
parts.next().unwrap().to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user