Merge branch 'master' into subnets-docs

This commit is contained in:
Lavanya Kasturi
2023-03-24 14:27:27 -05:00
committed by GitHub
6 changed files with 18 additions and 12 deletions

View File

@@ -174,7 +174,9 @@ impl BurnchainBlock {
}
pub fn timestamp(&self) -> u64 {
0
match self {
BurnchainBlock::StacksSubnetBlock(b) => b.burn_block_time,
}
}
pub fn header(&self) -> BurnchainBlockHeader {

View File

@@ -85,11 +85,12 @@ impl std::fmt::Debug for NewBlock {
fn fmt(&self, f: &mut Formatter) -> Result<(), std::fmt::Error> {
write!(
f,
"NewBlock(hash={:?}, parent_hash={:?}, block_height={}, num_events={})",
"NewBlock(hash={:?}, parent_hash={:?}, block_height={}, num_events={}, burn_block_time={})",
&self.index_block_hash,
&self.parent_index_block_hash,
self.block_height,
self.events.len()
self.events.len(),
self.burn_block_time
)
}
}
@@ -545,6 +546,7 @@ impl StacksSubnetBlock {
index_block_hash,
parent_index_block_hash,
block_height,
burn_block_time,
..
} = b;
@@ -604,6 +606,7 @@ impl StacksSubnetBlock {
current_block: index_block_hash,
parent_block: parent_index_block_hash,
block_height,
burn_block_time,
ops,
}
}

View File

@@ -317,6 +317,7 @@ pub struct StacksSubnetBlock {
pub current_block: StacksBlockId,
pub parent_block: StacksBlockId,
pub block_height: u64,
pub burn_block_time: u64,
pub ops: Vec<StacksSubnetOp>,
}

View File

@@ -433,6 +433,7 @@ impl TestBurnchainBlock {
parent_block: StacksBlockId(self.parent_snapshot.burn_header_hash.0.clone()),
ops: vec![],
block_height: self.block_height,
burn_block_time: 0,
};
let block = BurnchainBlock::StacksSubnetBlock(mock_bitcoin_block);
@@ -487,6 +488,7 @@ impl TestBurnchainBlock {
parent_block: StacksBlockId(self.parent_snapshot.burn_header_hash.0.clone()),
ops: vec![],
block_height: self.block_height,
burn_block_time: 0,
};
let block = BurnchainBlock::StacksSubnetBlock(mock_bitcoin_block);

View File

@@ -57,8 +57,13 @@ pub const SUBNETS_CLARITY_VERSION: ClarityVersion = ClarityVersion::Clarity2;
// first byte == major network protocol version (currently 0x18)
// second and third bytes are unused
// fourth byte == highest epoch supported by this node (0x05 for 2.05)
pub const PEER_VERSION_MAINNET: u32 = 0x18000005;
pub const PEER_VERSION_TESTNET: u32 = 0xfacade05;
/// Note these are Stacks (L1) peer versions, but these are also used
/// as the peer versions for subnets currently. Subnets do not have an
/// independent notion of peer versions. If a particular subnet wishes
/// to undergo a consensus change and use peer versioning to assist in
/// that change, subnets will need to introduce an independent peer version.
pub const PEER_VERSION_MAINNET: u32 = 0x18000006;
pub const PEER_VERSION_TESTNET: u32 = 0xfacade06;
pub const PEER_VERSION_EPOCH_1_0: u8 = 0x00;
pub const PEER_VERSION_EPOCH_2_0: u8 = 0x00;

View File

@@ -684,13 +684,6 @@ impl RunLoop {
}
}
target_burnchain_block_height = burnchain_config.reward_cycle_to_block_height(
burnchain_config
.block_height_to_reward_cycle(burnchain_height)
.expect("BUG: block height is not in a reward cycle")
+ 1,
);
if sortition_db_height >= burnchain_height && !ibd {
let canonical_stacks_tip_height =
SortitionDB::get_canonical_burn_chain_tip(burnchain.sortdb_ref().conn())