|
|
@@ -16,13 +16,12 @@
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
*/
|
|
|
|
|
|
-use darkfi_serial::serialize;
|
|
|
use log::debug;
|
|
|
|
|
|
use crate::{
|
|
|
consensus::{Block, BlockInfo, SlotCheckpoint},
|
|
|
util::time::Timestamp,
|
|
|
- Error, Result,
|
|
|
+ Result,
|
|
|
};
|
|
|
|
|
|
pub mod block_store;
|
|
|
@@ -179,27 +178,6 @@ impl Blockchain {
|
|
|
self.order.get_last()
|
|
|
}
|
|
|
|
|
|
- /// Retrieve last finalized block leader proof hash.
|
|
|
- pub fn get_last_proof_hash(&self) -> Result<blake3::Hash> {
|
|
|
- let (_, hash) = self.last().unwrap();
|
|
|
- let blocks = self.blocks.get(&[hash], true)?;
|
|
|
- // Since we used strict get, its safe to unwrap here
|
|
|
- let block = blocks[0].clone().unwrap();
|
|
|
- let hash = blake3::hash(&serialize(&block.lead_info.proof));
|
|
|
- Ok(hash)
|
|
|
- }
|
|
|
-
|
|
|
- pub fn get_proof_hash_by_slot(&self, slot: u64) -> Result<blake3::Hash> {
|
|
|
- let blocks = self.get_blocks_by_slot(&[slot]).unwrap();
|
|
|
- if blocks.is_empty() {
|
|
|
- return Err(Error::BlockNotFound("block not found".to_string()))
|
|
|
- }
|
|
|
- // Since we used strict get, its safe to unwrap here
|
|
|
- let block = blocks[0].clone();
|
|
|
- let hash = blake3::hash(&serialize(&block.lead_info.proof));
|
|
|
- Ok(hash)
|
|
|
- }
|
|
|
-
|
|
|
/// Retrieve the last slot checkpoint.
|
|
|
pub fn last_slot_checkpoint(&self) -> Result<SlotCheckpoint> {
|
|
|
self.slot_checkpoints.get_last()
|