mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
Move payload_attributes function to trait (#12427)
This commit is contained in:
@ -156,6 +156,18 @@ where
|
||||
let _ = self.to_service.send(PayloadServiceCommand::Subscribe(tx));
|
||||
Ok(PayloadEvents { receiver: rx.await? })
|
||||
}
|
||||
|
||||
/// Returns the payload attributes associated with the given identifier.
|
||||
///
|
||||
/// Note: this returns the attributes of the payload and does not resolve the job.
|
||||
async fn payload_attributes(
|
||||
&self,
|
||||
id: PayloadId,
|
||||
) -> Option<Result<T::PayloadBuilderAttributes, PayloadBuilderError>> {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
self.to_service.send(PayloadServiceCommand::PayloadAttributes(id, tx)).ok()?;
|
||||
rx.await.ok()?
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> PayloadBuilderHandle<T>
|
||||
@ -169,18 +181,6 @@ where
|
||||
pub const fn new(to_service: mpsc::UnboundedSender<PayloadServiceCommand<T>>) -> Self {
|
||||
Self { to_service }
|
||||
}
|
||||
|
||||
/// Returns the payload attributes associated with the given identifier.
|
||||
///
|
||||
/// Note: this returns the attributes of the payload and does not resolve the job.
|
||||
async fn payload_attributes(
|
||||
&self,
|
||||
id: PayloadId,
|
||||
) -> Option<Result<T::PayloadBuilderAttributes, PayloadBuilderError>> {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
self.to_service.send(PayloadServiceCommand::PayloadAttributes(id, tx)).ok()?;
|
||||
rx.await.ok()?
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Clone for PayloadBuilderHandle<T>
|
||||
|
||||
Reference in New Issue
Block a user