// This is going away and being replaced by getblocks
This is going away and being replaced by getblocks
This is going away and being replaced by getblocks
fn block(block_index: BlockHeight) -> Option<Result<EncodedBlock, CanisterId>> {
    let state = LEDGER.read().unwrap();
    if block_index < state.blockchain.num_archived_blocks() {
        // The block we are looking for better be in the archive because it has
        // a height smaller than the number of blocks we've archived so far
        let result = state
            .find_block_in_archive(block_index)
            .expect("block not found in the archive");
        Some(Err(result))
    // Or the block may be in the ledger, or the block may not exist
    } else {
        print(format!(
            "[ledger] Checking the ledger for block [{}]",
            block_index
        ));
        state.blockchain.get(block_index).cloned().map(Ok)
    }
}
fn block ( block_index : BlockHeight ) -> Option < Result < EncodedBlock , CanisterId > > { let state = LEDGER . read ( ) . unwrap ( ) ; if block_index < state . blockchain . num_archived_blocks ( ) { // The block we are looking for better be in the archive because it has // a height smaller than the number of blocks we've archived so far let result = state . find_block_in_archive ( block_index ) . expect ( " " ) ; Some ( Err ( result ) ) // Or the block may be in the ledger, or the block may not exist } else { print ( format ! ( " " block_index ) ) ; state . blockchain . get ( block_index ) . cloned ( ) . map ( Ok ) } }
This is going away and being replaced by getblocks
This is going away and being replaced by getblocks
block_index
BlockHeight