Skip to content

Commit 6661194

Browse files
committed
CRC: get sort db from SortitionDB
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent be1f6ed commit 6661194

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

libsigner/src/v0/messages.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ MinerSlotID {
8888
/// Block proposal from the miner
8989
BlockProposal = 0,
9090
/// Block pushed from the miner
91-
BlockPushed = 1,
92-
/// Mock Miner Message from the miner
93-
MockMinerMessage = 2
91+
BlockPushed = 1
9492
});
9593

9694
impl MessageSlotIDTrait for MessageSlotID {

stackslib/src/net/stackerdb/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ pub const STACKERDB_MAX_PAGE_COUNT: u32 = 2;
152152

153153
pub const STACKERDB_SLOTS_FUNCTION: &str = "stackerdb-get-signer-slots";
154154
pub const STACKERDB_CONFIG_FUNCTION: &str = "stackerdb-get-config";
155-
pub const MINER_SLOT_COUNT: u32 = 3;
155+
pub const MINER_SLOT_COUNT: u32 = 2;
156156

157157
/// Final result of synchronizing state with a remote set of DB replicas
158158
#[derive(Clone)]

testnet/stacks-node/src/neon_node.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ use stacks::net::stackerdb::{StackerDBConfig, StackerDBSync, StackerDBs, MINER_S
194194
use stacks::net::{
195195
Error as NetError, NetworkResult, PeerNetworkComms, RPCHandlerArgs, ServiceFlags,
196196
};
197-
use stacks::types::StacksEpoch;
198197
use stacks::util_lib::strings::{UrlString, VecDisplay};
199198
use stacks::{monitoring, version_string};
200199
use stacks_common::codec::StacksMessageCodec;
@@ -2274,20 +2273,9 @@ impl BlockMinerThread {
22742273
let burn_db_path = self.config.get_burn_db_file_path();
22752274
let burn_db = SortitionDB::open(&burn_db_path, false, self.burnchain.pox_constants.clone())
22762275
.expect("FATAL: could not open sortition DB");
2277-
let epochs = SortitionDB::get_stacks_epochs(burn_db.conn())
2278-
.expect("Error while loading stacks epochs");
2279-
let epoch_index = StacksEpoch::find_epoch(&epochs, self.burn_block.block_height)
2280-
.unwrap_or_else(|| {
2281-
panic!(
2282-
"BUG: block {} is not in a known epoch",
2283-
self.burn_block.block_height
2284-
)
2285-
});
2286-
let epoch_id = epochs
2287-
.get(epoch_index)
2288-
.expect("BUG: no epoch at found index")
2276+
let epoch_id = SortitionDB::get_stacks_epoch(burn_db.conn(), self.burn_block.block_height)?
2277+
.expect("FATAL: no epoch defined")
22892278
.epoch_id;
2290-
22912279
if epoch_id != StacksEpochId::Epoch25 {
22922280
debug!("Mock miner messaging is disabled for non-epoch 2.5 blocks.";
22932281
"epoch_id" => epoch_id.to_string()
@@ -2405,7 +2393,7 @@ impl BlockMinerThread {
24052393
&self.burn_block,
24062394
&stackerdbs,
24072395
SignerMessage::MockMinerMessage(message.clone()),
2408-
MinerSlotID::MockMinerMessage,
2396+
MinerSlotID::BlockProposal, // There is no specific slot for mock miner messages
24092397
self.config.is_mainnet(),
24102398
&mut miners_stackerdb,
24112399
&election_sortition,

0 commit comments

Comments
 (0)