mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-06-16 01:24:25 +08:00
fix: the current burn height is the height of the latest sortition, not what we've seen in the Clarity DB
This commit is contained in:
@@ -269,19 +269,18 @@ impl RPCPoxInfoData {
|
||||
) -> Result<RPCPoxInfoData, net_error> {
|
||||
let mainnet = chainstate.mainnet;
|
||||
let chain_id = chainstate.chain_id;
|
||||
|
||||
let current_burn_height = chainstate
|
||||
.with_read_only_clarity_tx(&sortdb.index_conn(), tip, |clarity_tx| {
|
||||
clarity_tx.with_clarity_db_readonly(|clarity_db| {
|
||||
clarity_db.get_current_burnchain_block_height() as u64
|
||||
})
|
||||
})
|
||||
.ok_or(net_error::NotFoundError)?;
|
||||
let current_burn_height =
|
||||
SortitionDB::get_canonical_burn_chain_tip(sortdb.conn())?.block_height;
|
||||
|
||||
let pox_contract_name = burnchain
|
||||
.pox_constants
|
||||
.active_pox_contract(current_burn_height);
|
||||
|
||||
debug!(
|
||||
"Active PoX contract is '{}' (current_burn_height = {}, v1_unlock_height = {}",
|
||||
&pox_contract_name, current_burn_height, burnchain.pox_constants.v1_unlock_height
|
||||
);
|
||||
|
||||
let contract_identifier = boot_code_id(pox_contract_name, mainnet);
|
||||
let function = "get-pox-info";
|
||||
let cost_track = LimitedCostTracker::new_free();
|
||||
@@ -306,7 +305,7 @@ impl RPCPoxInfoData {
|
||||
clarity_tx.with_readonly_clarity_env(
|
||||
mainnet,
|
||||
chain_id,
|
||||
ClarityVersion::Clarity1,
|
||||
ClarityVersion::Clarity2,
|
||||
sender,
|
||||
None,
|
||||
cost_track,
|
||||
|
||||
Reference in New Issue
Block a user