Implement calculation of monotonic network times for Bitcoin and Monero

This commit is contained in:
Luke Parker
2023-11-09 05:17:34 -05:00
parent 43ae6794db
commit 19187d2c30
5 changed files with 93 additions and 15 deletions

View File

@@ -181,13 +181,16 @@ impl<E: Eventuality> Default for EventualitiesTracker<E> {
}
}
#[async_trait]
pub trait Block<N: Network>: Send + Sync + Sized + Clone + Debug {
// This is currently bounded to being 32 bytes.
type Id: 'static + Id;
fn id(&self) -> Self::Id;
fn parent(&self) -> Self::Id;
// The monotonic network time at this block.
fn time(&self) -> u64;
/// The monotonic network time at this block.
///
/// This call is presumed to be expensive and should only be called sparingly.
async fn time(&self, rpc: &N) -> u64;
}
// The post-fee value of an expected branch.