This commit is contained in:
hinto.janai 2024-11-17 21:00:27 -05:00
parent 2d2d4931f8
commit 86f2dd1586
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
3 changed files with 9 additions and 4 deletions

View file

@ -35,7 +35,10 @@ pub enum BlockchainManagerRequest {
Pruned,
/// Relay a block to the network.
RelayBlock(Block),
RelayBlock(
/// This is [`Box`]ed due to `clippy::large_enum_variant`.
Box<Block>,
),
/// Is the blockchain in the middle of syncing?
///

View file

@ -166,7 +166,7 @@ async fn submit_block(
let block_id = hex::encode(block.hash());
// Attempt to relay the block.
blockchain_manager::relay_block(&mut state.blockchain_manager, block).await?;
blockchain_manager::relay_block(&mut state.blockchain_manager, Box::new(block)).await?;
Ok(SubmitBlockResponse {
base: ResponseBase::OK,
@ -1059,7 +1059,9 @@ fn add_aux_pow_inner(
let mut slots: Box<[u32]> = vec![u32::MAX; aux_pow_len].into_boxed_slice();
let mut slot_seen: Box<[bool]> = vec![false; aux_pow_len].into_boxed_slice();
for nonce in 0..u32::MAX {
const MAX_NONCE: u32 = 65535;
for nonce in 0..=MAX_NONCE {
for i in &mut slots {
let slot_u32: u32 = todo!("const uint32_t slot = cryptonote::get_aux_slot(aux_pow[idx].first, nonce, aux_pow.size());");
let slot = u32_to_usize(slot_u32);

View file

@ -67,7 +67,7 @@ pub(crate) async fn pruned(
/// [`BlockchainManagerRequest::RelayBlock`]
pub(crate) async fn relay_block(
blockchain_manager: &mut BlockchainManagerHandle,
block: Block,
block: Box<Block>,
) -> Result<(), Error> {
let BlockchainManagerResponse::Ok = blockchain_manager
.ready()