mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: restructure op builder (#12229)
This commit is contained in:
@ -790,6 +790,37 @@ impl<Payload> BuildOutcome<Payload> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The possible outcomes of a payload building attempt without reused [`CachedReads`]
|
||||
#[derive(Debug)]
|
||||
pub enum BuildOutcomeKind<Payload> {
|
||||
/// Successfully built a better block.
|
||||
Better {
|
||||
/// The new payload that was built.
|
||||
payload: Payload,
|
||||
},
|
||||
/// Aborted payload building because resulted in worse block wrt. fees.
|
||||
Aborted {
|
||||
/// The total fees associated with the attempted payload.
|
||||
fees: U256,
|
||||
},
|
||||
/// Build job was cancelled
|
||||
Cancelled,
|
||||
/// The payload is final and no further building should occur
|
||||
Freeze(Payload),
|
||||
}
|
||||
|
||||
impl<Payload> BuildOutcomeKind<Payload> {
|
||||
/// Attaches the [`CachedReads`] to the outcome.
|
||||
pub fn with_cached_reads(self, cached_reads: CachedReads) -> BuildOutcome<Payload> {
|
||||
match self {
|
||||
Self::Better { payload } => BuildOutcome::Better { payload, cached_reads },
|
||||
Self::Aborted { fees } => BuildOutcome::Aborted { fees, cached_reads },
|
||||
Self::Cancelled => BuildOutcome::Cancelled,
|
||||
Self::Freeze(payload) => BuildOutcome::Freeze(payload),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A collection of arguments used for building payloads.
|
||||
///
|
||||
/// This struct encapsulates the essential components and configuration required for the payload
|
||||
|
||||
Reference in New Issue
Block a user