From 3e86bb54d4f39f412437d44a9ceb66c878d050c5 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 7 Jan 2025 14:50:56 +0100 Subject: [PATCH] docs: add additional BasicPayloadJob docs (#13706) --- crates/payload/basic/src/lib.rs | 9 +++++++++ crates/payload/builder/src/traits.rs | 2 ++ 2 files changed, 11 insertions(+) diff --git a/crates/payload/basic/src/lib.rs b/crates/payload/basic/src/lib.rs index 1b8bc6ba7c..b8cec6dace 100644 --- a/crates/payload/basic/src/lib.rs +++ b/crates/payload/basic/src/lib.rs @@ -295,6 +295,15 @@ impl Default for BasicPayloadJobGeneratorConfig { } /// A basic payload job that continuously builds a payload with the best transactions from the pool. +/// +/// This type is a [`PayloadJob`] and [`Future`] that terminates when the deadline is reached or +/// when the job is resolved: [`PayloadJob::resolve`]. +/// +/// This basic job implementation will trigger new payload build task continuously until the job is +/// resolved or the deadline is reached, or until the built payload is marked as frozen: +/// [`BuildOutcome::Freeze`]. Once a frozen payload is returned, no additional payloads will be +/// built and this future will wait to be resolved: [`PayloadJob::resolve`] or terminated if the +/// deadline is reached.. #[derive(Debug)] pub struct BasicPayloadJob where diff --git a/crates/payload/builder/src/traits.rs b/crates/payload/builder/src/traits.rs index 34a756e605..807bfa186e 100644 --- a/crates/payload/builder/src/traits.rs +++ b/crates/payload/builder/src/traits.rs @@ -67,6 +67,8 @@ pub trait PayloadJob: Future> + Send + ) -> (Self::ResolvePayloadFuture, KeepPayloadJobAlive); /// Resolves the payload as fast as possible. + /// + /// See also [`PayloadJob::resolve_kind`] fn resolve(&mut self) -> (Self::ResolvePayloadFuture, KeepPayloadJobAlive) { self.resolve_kind(PayloadKind::Earliest) }