mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 11:01:01 +00:00
proposer: return optional block (#2834)
This opens up the proposer to only optionally create blocks. Nodes may only make blocks when there are transactions or the chain is scheduled. --------- Co-authored-by: command-bot <>
This commit is contained in:
@@ -76,7 +76,7 @@ pub trait ProposerInterface<Block: BlockT> {
|
||||
inherent_digests: Digest,
|
||||
max_duration: Duration,
|
||||
block_size_limit: Option<usize>,
|
||||
) -> Result<Proposal<Block, StorageProof>, Error>;
|
||||
) -> Result<Option<Proposal<Block, StorageProof>>, Error>;
|
||||
}
|
||||
|
||||
/// A simple wrapper around a Substrate proposer for creating collations.
|
||||
@@ -109,7 +109,7 @@ where
|
||||
inherent_digests: Digest,
|
||||
max_duration: Duration,
|
||||
block_size_limit: Option<usize>,
|
||||
) -> Result<Proposal<B, StorageProof>, Error> {
|
||||
) -> Result<Option<Proposal<B, StorageProof>>, Error> {
|
||||
let proposer = self
|
||||
.inner
|
||||
.init(parent_header)
|
||||
@@ -127,6 +127,7 @@ where
|
||||
proposer
|
||||
.propose(inherent_data, inherent_digests, max_duration, block_size_limit)
|
||||
.await
|
||||
.map(Some)
|
||||
.map_err(|e| Error::proposing(anyhow::Error::new(e)).into())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user