Skip to content

Commit d4860f8

Browse files
committed
Rename NewNakamotoBlock to NewBlock
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent bf70c9f commit d4860f8

File tree

4 files changed

+10
-34
lines changed

4 files changed

+10
-34
lines changed

libsigner/src/events.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ pub enum SignerEvent<T: SignerEventTrait> {
114114
/// the time at which this event was received by the signer's event processor
115115
received_time: SystemTime,
116116
},
117-
/// A new processed Nakamoto block was received from the node with the given block hash
118-
NewNakamotoBlock {
117+
/// A new processed Stacks block was received from the node with the given block hash
118+
NewBlock {
119119
/// The block header hash for the newly processed stacks block
120120
block_hash: Sha512Trunc256Sum,
121121
/// The block height for the newly processed stacks block
@@ -568,7 +568,7 @@ fn process_new_block<T: SignerEventTrait>(
568568
Sha512Trunc256Sum::from_hex(hex)
569569
.map_err(|e| EventError::Deserialize(format!("Invalid hex string: {e}")))
570570
})?;
571-
let event = SignerEvent::NewNakamotoBlock {
571+
let event = SignerEvent::NewBlock {
572572
block_hash,
573573
block_height: temp.block_height,
574574
};

stacks-signer/src/signerdb.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,10 @@ impl BlockInfo {
230230
}
231231
match state {
232232
BlockState::Unprocessed => false,
233-
BlockState::LocallyAccepted | BlockState::LocallyRejected => {
234-
!matches!(prev_state, BlockState::GloballyRejected)
235-
&& !matches!(prev_state, BlockState::GloballyAccepted)
236-
}
233+
BlockState::LocallyAccepted | BlockState::LocallyRejected => !matches!(
234+
prev_state,
235+
BlockState::GloballyRejected | BlockState::GloballyAccepted
236+
),
237237
BlockState::GloballyAccepted => !matches!(prev_state, BlockState::GloballyRejected),
238238
BlockState::GloballyRejected => !matches!(prev_state, BlockState::GloballyAccepted),
239239
}

stacks-signer/src/v0/signer.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl SignerTrait<SignerMessage> for Signer {
126126
Some(SignerEvent::BlockValidationResponse(_))
127127
| Some(SignerEvent::MinerMessages(..))
128128
| Some(SignerEvent::NewBurnBlock { .. })
129-
| Some(SignerEvent::NewNakamotoBlock { .. })
129+
| Some(SignerEvent::NewBlock { .. })
130130
| Some(SignerEvent::StatusCheck)
131131
| None => None,
132132
Some(SignerEvent::SignerMessages(msg_parity, ..)) => Some(u64::from(*msg_parity) % 2),
@@ -247,7 +247,7 @@ impl SignerTrait<SignerMessage> for Signer {
247247
});
248248
*sortition_state = None;
249249
}
250-
SignerEvent::NewNakamotoBlock {
250+
SignerEvent::NewBlock {
251251
block_hash,
252252
block_height,
253253
} => {
@@ -400,6 +400,7 @@ impl Signer {
400400
"burn_height" => block_proposal.burn_height,
401401
);
402402
crate::monitoring::increment_block_proposals_received();
403+
#[allow(unused_mut)]
403404
let mut block_info = BlockInfo::from(block_proposal.clone());
404405

405406
// Get sortition view if we don't have it
@@ -532,10 +533,6 @@ impl Signer {
532533
stacks_client: &StacksClient,
533534
block_response: &BlockResponse,
534535
) {
535-
#[cfg(any(test, feature = "testing"))]
536-
if self.test_ignore_block_responses(block_response) {
537-
return;
538-
}
539536
match block_response {
540537
BlockResponse::Accepted(accepted) => {
541538
self.handle_block_signature(stacks_client, accepted);

testnet/stacks-node/src/event_dispatcher.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ use url::Url;
7070

7171
use super::config::{EventKeyType, EventObserverConfig};
7272

73-
#[cfg(test)]
74-
pub static TEST_SKIP_BLOCK_ANNOUNCEMENT: std::sync::Mutex<Option<bool>> =
75-
std::sync::Mutex::new(None);
76-
7773
#[derive(Debug, Clone)]
7874
struct EventObserver {
7975
/// Path to the database where pending payloads are stored. If `None`, then
@@ -1303,11 +1299,6 @@ impl EventDispatcher {
13031299

13041300
let mature_rewards = serde_json::Value::Array(mature_rewards_vec);
13051301

1306-
#[cfg(any(test, feature = "testing"))]
1307-
if test_skip_block_announcement(&block) {
1308-
return;
1309-
}
1310-
13111302
for (observer_id, filtered_events_ids) in dispatch_matrix.iter().enumerate() {
13121303
let filtered_events: Vec<_> = filtered_events_ids
13131304
.iter()
@@ -1704,18 +1695,6 @@ impl EventDispatcher {
17041695
}
17051696
}
17061697

1707-
#[cfg(any(test, feature = "testing"))]
1708-
fn test_skip_block_announcement(block: &StacksBlockEventData) -> bool {
1709-
if *TEST_SKIP_BLOCK_ANNOUNCEMENT.lock().unwrap() == Some(true) {
1710-
warn!(
1711-
"Skipping new block announcement due to testing directive";
1712-
"block_hash" => %block.block_hash
1713-
);
1714-
return true;
1715-
}
1716-
false
1717-
}
1718-
17191698
#[cfg(test)]
17201699
mod test {
17211700
use std::net::TcpListener;

0 commit comments

Comments
 (0)