Skip to content

Instantly share code, notes, and snippets.

@jmcph4
Last active October 11, 2024 09:47
Show Gist options
  • Select an option

  • Save jmcph4/91b05bc5f512bbc2aa0caf58b80406db to your computer and use it in GitHub Desktop.

Select an option

Save jmcph4/91b05bc5f512bbc2aa0caf58b80406db to your computer and use it in GitHub Desktop.
fn new_payload_job(
&self,
attributes: <Builder as PayloadBuilder<Pool, Client>>::Attributes,
) -> Result<Self::Job, PayloadBuilderError> {
panic!("KABOOM");
let parent_block = if attributes.parent().is_zero() {
// use latest block if parent is zero: genesis block
self.client
.block_by_number_or_tag(BlockNumberOrTag::Latest)?
.ok_or_else(|| PayloadBuilderError::MissingParentBlock(attributes.parent()))?
.seal_slow()
} else {
let block = self
.client
.find_block_by_hash(attributes.parent(), BlockSource::Any)?
.ok_or_else(|| PayloadBuilderError::MissingParentBlock(attributes.parent()))?;
// we already know the hash, so we can seal it
block.seal(attributes.parent())
};
let config = PayloadConfig::new(Arc::new(parent_block), Bytes::default(), attributes);
Ok(EmptyBlockPayloadJob {
client: self.client.clone(),
_pool: self.pool.clone(),
_executor: self.executor.clone(),
builder: self.builder.clone(),
config,
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment