File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 3
3
use core:: clone:: Clone ;
4
4
use std:: sync:: Arc ;
5
5
6
- use academy_pow_runtime:: { self , opaque:: Block , RuntimeApi } ;
6
+ use academy_pow_runtime:: { self , opaque:: Block , PreDigest , RuntimeApi } ;
7
7
use multi_pow:: { ForkingConfig , MultiPow , SupportedHashes } ;
8
8
use parity_scale_codec:: Encode ;
9
9
use sc_consensus:: LongestChain ;
@@ -238,7 +238,7 @@ pub fn new_full(
238
238
// This allows us to know which algo it was in the runtime.
239
239
// TODO This also makes it possible to remove the algo info from
240
240
// the seal.
241
- Some ( mining_algo. encode ( ) ) ,
241
+ Some ( PreDigest :: from ( ( sr25519_public_key . into ( ) , mining_algo) ) . encode ( ) ) ,
242
242
// This code is copied from above. Would be better to not repeat it.
243
243
move |_, ( ) | async move {
244
244
let timestamp = sp_timestamp:: InherentDataProvider :: from_system_time ( ) ;
Original file line number Diff line number Diff line change @@ -79,6 +79,9 @@ pub type Index = u32;
79
79
/// A hash of some data used by the chain.
80
80
pub type Hash = sp_core:: H256 ;
81
81
82
+ /// Consensus digest containing block author and supported hash algorithm.
83
+ pub type PreDigest = ( AccountId , SupportedHashes ) ;
84
+
82
85
/// The BlockAuthor trait in `./block_author.rs`
83
86
pub mod block_author;
84
87
@@ -239,7 +242,8 @@ fn current_blocks_mining_algo() -> SupportedHashes {
239
242
. iter ( )
240
243
. find_map ( |digest_item| {
241
244
match digest_item {
242
- DigestItem :: PreRuntime ( POW_ENGINE_ID , encoded_algo) => SupportedHashes :: decode ( & mut & encoded_algo[ ..] ) . ok ( ) ,
245
+ DigestItem :: PreRuntime ( POW_ENGINE_ID , pre_digest) =>
246
+ PreDigest :: decode ( & mut & pre_digest[ ..] ) . map ( |d| d. 1 ) . ok ( ) ,
243
247
_ => None ,
244
248
}
245
249
} )
You can’t perform that action at this time.
0 commit comments