File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -164,13 +164,20 @@ impl frame_system::offchain::CreateSignedTransaction<pallet_drand::Call<Runtime>
164164 ) -> Option < Self :: Extrinsic > {
165165 use sp_runtime:: traits:: StaticLookup ;
166166
167+ // Transaction validity period from block hash included in signature
168+ // Has to a power of 2. 256 blocks yields to 3072 s = 51.2 minutes.
169+ let validity_period = 256_u64 ;
170+ let current_block = frame_system:: Pallet :: < Runtime > :: block_number ( ) ;
171+ // Transaction validity era starts at the current block
172+ let era = Era :: mortal ( validity_period, current_block as u64 ) ;
173+
167174 let address = <Runtime as frame_system:: Config >:: Lookup :: unlookup ( account. clone ( ) ) ;
168175 let extra: TransactionExtensions = (
169176 frame_system:: CheckNonZeroSender :: < Runtime > :: new ( ) ,
170177 frame_system:: CheckSpecVersion :: < Runtime > :: new ( ) ,
171178 frame_system:: CheckTxVersion :: < Runtime > :: new ( ) ,
172179 frame_system:: CheckGenesis :: < Runtime > :: new ( ) ,
173- frame_system:: CheckEra :: < Runtime > :: from ( Era :: Immortal ) ,
180+ frame_system:: CheckEra :: < Runtime > :: from ( era ) ,
174181 check_nonce:: CheckNonce :: < Runtime > :: from ( nonce) . into ( ) ,
175182 frame_system:: CheckWeight :: < Runtime > :: new ( ) ,
176183 ChargeTransactionPaymentWrapper :: new (
You can’t perform that action at this time.
0 commit comments