Flesh out report task

This commit is contained in:
Luke Parker
2024-08-23 22:29:15 -04:00
parent fd12cc0213
commit d5d1fc3eea
5 changed files with 79 additions and 30 deletions

View File

@@ -6,12 +6,13 @@ use crate::{Id, Address, ReceivedOutput};
/// A block header from an external network.
pub trait BlockHeader: Send + Sync + Sized + Clone + Debug {
/// The type used to identify blocks.
type Id: 'static + Id;
/// The ID of this block.
fn id(&self) -> Self::Id;
///
/// This is fixed to 32-bytes and is expected to be cryptographically binding with 128-bit
/// security. This is not required to be the ID used natively by the external network.
fn id(&self) -> [u8; 32];
/// The ID of the parent block.
fn parent(&self) -> Self::Id;
fn parent(&self) -> [u8; 32];
}
/// A block from an external network.
@@ -33,7 +34,7 @@ pub trait Block: Send + Sync + Sized + Clone + Debug {
type Output: ReceivedOutput<Self::Key, Self::Address>;
/// The ID of this block.
fn id(&self) -> <Self::Header as BlockHeader>::Id;
fn id(&self) -> [u8; 32];
/// Scan all outputs within this block to find the outputs spendable by this key.
fn scan_for_outputs(&self, key: Self::Key) -> Vec<Self::Output>;