mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Small tweaks to staking miner (#3460)
* Fix miner * fix miner * Update utils/staking-miner/src/monitor.rs * Fix width
This commit is contained in:
@@ -299,7 +299,7 @@ async fn create_election_ext<T: EPM::Config, B: BlockT>(
|
||||
with_staking: bool,
|
||||
) -> Result<Ext, Error> {
|
||||
use frame_support::{storage::generator::StorageMap, traits::PalletInfo};
|
||||
let system_block_hash_key = <frame_system::BlockHash<T>>::prefix_hash();
|
||||
use sp_core::hashing::twox_128;
|
||||
|
||||
Builder::<B>::new()
|
||||
.mode(Mode::Online(OnlineConfig {
|
||||
@@ -322,7 +322,8 @@ async fn create_election_ext<T: EPM::Config, B: BlockT>(
|
||||
},
|
||||
..Default::default()
|
||||
}))
|
||||
.inject_hashed_prefix(&system_block_hash_key)
|
||||
.inject_hashed_prefix(&<frame_system::BlockHash<T>>::prefix_hash())
|
||||
.inject_hashed_key(&[twox_128(b"System"), twox_128(b"Number")].concat())
|
||||
.build()
|
||||
.await
|
||||
.map_err(|why| Error::RemoteExternalities(why))
|
||||
|
||||
@@ -122,10 +122,21 @@ macro_rules! monitor_cmd_for { ($runtime:tt) => { paste::paste! {
|
||||
|
||||
let mut tx_subscription: Subscription<
|
||||
TransactionStatus<<Block as BlockT>::Hash, <Block as BlockT>::Hash>
|
||||
> = client
|
||||
> = match client
|
||||
.subscribe(&"author_submitAndWatchExtrinsic", params! { bytes }, "author_unwatchExtrinsic")
|
||||
.await
|
||||
.unwrap();
|
||||
{
|
||||
Ok(sub) => sub,
|
||||
Err(why) => {
|
||||
// This usually happens when we've been busy with mining for a few blocks, and now we're receiving the
|
||||
// subscriptions of blocks in which we were busy. In these blocks, we still don't have a solution, so we
|
||||
// re-compute a new solution and submit it with an outdated `Nonce`, which yields most often `Stale`
|
||||
// error. NOTE: to improve this overall, and to be able to introduce an array of other fancy features,
|
||||
// we should make this multi-threaded and do the computation outside of this callback.
|
||||
log::warn!(target: LOG_TARGET, "failing to submit a transaction {:?}. continuing...", why);
|
||||
continue
|
||||
}
|
||||
};
|
||||
|
||||
let _success = while let Some(status_update) = tx_subscription.next().await? {
|
||||
log::trace!(target: LOG_TARGET, "status update {:?}", status_update);
|
||||
|
||||
Reference in New Issue
Block a user