Skip to content

Commit aacd4d3

Browse files
committed
Merge branch 'fix/burn-view' of https://github.com/stacks-network/stacks-core into fix/burn-view
2 parents 2f675a4 + 1cfc225 commit aacd4d3

File tree

7 files changed

+385
-8
lines changed

7 files changed

+385
-8
lines changed

.github/workflows/bitcoin-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ jobs:
142142
- tests::signer::v0::incoming_signers_ignore_block_proposals
143143
- tests::signer::v0::outgoing_signers_ignore_block_proposals
144144
- tests::signer::v0::injected_signatures_are_ignored_across_boundaries
145+
- tests::signer::v0::fast_sortition
145146
- tests::nakamoto_integrations::burn_ops_integration_test
146147
- tests::nakamoto_integrations::check_block_heights
147148
- tests::nakamoto_integrations::clarity_burn_state

stackslib/src/burnchains/bitcoin/indexer.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,8 +1100,10 @@ impl BurnchainIndexer for BitcoinIndexer {
11001100
start_height: u64,
11011101
end_height: Option<u64>,
11021102
) -> Result<u64, burnchain_error> {
1103-
if end_height.is_some() && end_height <= Some(start_height) {
1104-
return Ok(end_height.unwrap());
1103+
if let Some(end_height) = end_height {
1104+
if end_height <= start_height {
1105+
return Ok(end_height);
1106+
}
11051107
}
11061108

11071109
let new_height = self

stackslib/src/burnchains/tests/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl BurnchainDB {
5959
let sql = "SELECT op FROM burnchain_db_block_ops WHERE block_hash = ?1";
6060
let args = params![block_hash];
6161
let mut ops: Vec<BlockstackOperationType> = query_rows(&self.conn, sql, args)?;
62-
ops.sort_by(|a, b| a.vtxindex().cmp(&b.vtxindex()));
62+
ops.sort_by_key(|op| op.vtxindex());
6363
Ok(ops)
6464
}
6565

stackslib/src/chainstate/nakamoto/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3049,7 +3049,7 @@ fn filter_one_transaction_per_signer_duplicate_nonces() {
30493049
txs.clone(),
30503050
);
30513051
let filtered_txs: Vec<_> = filtered_transactions.into_values().collect();
3052-
txs.sort_by(|a, b| a.txid().cmp(&b.txid()));
3052+
txs.sort_by_key(|tx| tx.txid());
30533053
assert_eq!(filtered_txs.len(), 1);
30543054
assert!(filtered_txs.contains(&txs.first().expect("failed to get first tx")));
30553055
}

testnet/stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,9 @@ pub fn get_latest_block_proposal(
454454
info!("Consider block"; "signer_sighash" => %b.header.signer_signature_hash(), "is_latest_sortition" => is_latest, "chain_height" => b.header.chain_length);
455455
}
456456

457-
let (proposed_block, miner_addr, _) = proposed_blocks.pop().unwrap();
457+
let Some((proposed_block, miner_addr, _)) = proposed_blocks.pop() else {
458+
return Err("No block proposals found".into());
459+
};
458460

459461
let pubkey = StacksPublicKey::recover_to_pubkey(
460462
proposed_block.header.miner_signature_hash().as_bytes(),

testnet/stacks-node/src/tests/neon_integrations.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ use stacks::net::api::getaccount::AccountEntryResponse;
5353
use stacks::net::api::getcontractsrc::ContractSrcResponse;
5454
use stacks::net::api::getinfo::RPCPeerInfoData;
5555
use stacks::net::api::getpoxinfo::RPCPoxInfoData;
56+
use stacks::net::api::getsortition::SortitionInfo;
5657
use stacks::net::api::gettransaction_unconfirmed::UnconfirmedTransactionResponse;
5758
use stacks::net::api::postblock::StacksBlockAcceptedData;
5859
use stacks::net::api::postfeerate::RPCFeeEstimateResponse;
@@ -1351,7 +1352,7 @@ pub fn get_account_result<F: std::fmt::Display>(
13511352
let client = reqwest::blocking::Client::new();
13521353
let path = format!("{http_origin}/v2/accounts/{account}?proof=0");
13531354
let res = client.get(&path).send()?.json::<AccountEntryResponse>()?;
1354-
info!("Account response: {res:#?}");
1355+
debug!("Account response: {res:#?}");
13551356
Ok(Account {
13561357
balance: u128::from_str_radix(&res.balance[2..], 16).unwrap(),
13571358
locked: u128::from_str_radix(&res.locked[2..], 16).unwrap(),
@@ -1363,6 +1364,22 @@ pub fn get_account<F: std::fmt::Display>(http_origin: &str, account: &F) -> Acco
13631364
get_account_result(http_origin, account).unwrap()
13641365
}
13651366

1367+
pub fn get_sortition_info(conf: &Config) -> SortitionInfo {
1368+
let client = reqwest::blocking::Client::new();
1369+
let http_origin = format!("http://{}", &conf.node.rpc_bind);
1370+
let path = format!("{http_origin}/v3/sortitions");
1371+
let mut resp: Vec<_> = client.get(&path).send().unwrap().json().unwrap();
1372+
resp.pop().unwrap()
1373+
}
1374+
1375+
pub fn get_sortition_info_ch(conf: &Config, ch: &ConsensusHash) -> SortitionInfo {
1376+
let client = reqwest::blocking::Client::new();
1377+
let http_origin = format!("http://{}", &conf.node.rpc_bind);
1378+
let path = format!("{http_origin}/v3/sortitions/consensus/{ch}");
1379+
let mut resp: Vec<_> = client.get(&path).send().unwrap().json().unwrap();
1380+
resp.pop().unwrap()
1381+
}
1382+
13661383
pub fn get_neighbors(conf: &Config) -> Option<serde_json::Value> {
13671384
let client = reqwest::blocking::Client::new();
13681385
let http_origin = format!("http://{}", &conf.node.rpc_bind);

0 commit comments

Comments
 (0)