fn fetch_header_containing_utxo_mmr(&self, mmr_position: u64) -> Result<ChainHeader, ChainStorageError> {
        let txn = self.read_transaction()?;

        let (height, _hash) =
            lmdb_first_after::<_, (u64, Vec<u8>)>(&txn, &self.output_mmr_size_index, &mmr_position.to_be_bytes())?
                .ok_or_else(|| ChainStorageError::ValueNotFound {
                    entity: "output_mmr_size_index".to_string(),
                    field: "mmr_position".to_string(),
                    value: mmr_position.to_string(),
                })?;

        let header: BlockHeader =
            lmdb_get(&txn, &self.headers_db, &height)?.ok_or_else(|| ChainStorageError::ValueNotFound {
                entity: "BlockHeader".to_string(),
                field: "height".to_string(),
                value: height.to_string(),
            })?;
        let accum_data = self
            .fetch_header_accumulated_data_by_height(&txn, height)?
            .ok_or_else(|| ChainStorageError::ValueNotFound {
                entity: "BlockHeaderAccumulatedData".to_string(),
                field: "height".to_string(),
                value: height.to_string(),
            })?;

        let chain_header = ChainHeader::try_construct(header, accum_data).ok_or_else(|| {
            ChainStorageError::DataInconsistencyDetected {
                function: "fetch_header_containing_utxo_mmr",
                details: format!("Accumulated data mismatch at height #{}", height),
            }
        })?;
        Ok(chain_header)
    }
// TODO: Can be merged with the method above
Can be merged with the method above
Can be merged with the method above
fn fetch_header_containing_utxo_mmr(&self, mmr_position: u64) -> Result<ChainHeader, ChainStorageError> {
        let txn = self.read_transaction()?;
        let (height, _hash) =
            lmdb_first_after::<_, (u64, Vec<u8>)>(&txn, &self.output_mmr_size_index, &mmr_position.to_be_bytes())?
                .ok_or_else(|| ChainStorageError::ValueNotFound {
                    entity: "output_mmr_size_index".to_string(),
                    field: "mmr_position".to_string(),
                    value: mmr_position.to_string(),
                })?;
        let header: BlockHeader =
            lmdb_get(&txn, &self.headers_db, &height)?.ok_or_else(|| ChainStorageError::ValueNotFound {
                entity: "BlockHeader".to_string(),
                field: "height".to_string(),
                value: height.to_string(),
            })?;
        let accum_data = self
            .fetch_header_accumulated_data_by_height(&txn, height)?
            .ok_or_else(|| ChainStorageError::ValueNotFound {
                entity: "BlockHeaderAccumulatedData".to_string(),
                field: "height".to_string(),
                value: height.to_string(),
            })?;
        let chain_header = ChainHeader::try_construct(header, accum_data).ok_or_else(|| {
            ChainStorageError::DataInconsistencyDetected {
                function: "fetch_header_containing_utxo_mmr",
                details: format!("Accumulated data mismatch at height #{}", height),
            }
        })?;
        Ok(chain_header)
    }
fn fetch_header_containing_utxo_mmr ( & self , mmr_position : u64 ) -> Result < ChainHeader , ChainStorageError > { let txn = self . read_transaction ( ) ? ; let ( height , _hash ) = lmdb_first_after :: < _ , ( u64 , Vec < u8 > ) > ( & txn , & self . output_mmr_size_index , & mmr_position . to_be_bytes ( ) ) ? . ok_or_else ( | | ChainStorageError :: ValueNotFound { entity : " " . to_string ( ) , field : " " . to_string ( ) , value : mmr_position . to_string ( ) , } ) ? ; let header : BlockHeader = lmdb_get ( & txn , & self . headers_db , & height ) ? . ok_or_else ( | | ChainStorageError :: ValueNotFound { entity : " " . to_string ( ) , field : " " . to_string ( ) , value : height . to_string ( ) , } ) ? ; let accum_data = self . fetch_header_accumulated_data_by_height ( & txn , height ) ? . ok_or_else ( | | ChainStorageError :: ValueNotFound { entity : " " . to_string ( ) , field : " " . to_string ( ) , value : height . to_string ( ) , } ) ? ; let chain_header = ChainHeader :: try_construct ( header , accum_data ) . ok_or_else ( | | { ChainStorageError :: DataInconsistencyDetected { function : " " , details : format ! ( " " height ) , } } ) ? ; Ok ( chain_header ) }
TODO: Can be merged with the method above
TODO : Can be merged with the method above
&self
mmr_position
u64
&self
mmr_position
u64