Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,20 @@ impl frame_system::offchain::CreateSignedTransaction<pallet_drand::Call<Runtime>
) -> Option<Self::Extrinsic> {
use sp_runtime::traits::StaticLookup;

// Transaction validity period from block hash included in signature
// Has to a power of 2. 256 blocks yields to 3072 s = 51.2 minutes.
let validity_period = 256_u64;
let current_block = frame_system::Pallet::<Runtime>::block_number();
// Transaction validity era starts at the current block
let era = Era::mortal(validity_period, current_block as u64);

let address = <Runtime as frame_system::Config>::Lookup::unlookup(account.clone());
let extra: TransactionExtensions = (
frame_system::CheckNonZeroSender::<Runtime>::new(),
frame_system::CheckSpecVersion::<Runtime>::new(),
frame_system::CheckTxVersion::<Runtime>::new(),
frame_system::CheckGenesis::<Runtime>::new(),
frame_system::CheckEra::<Runtime>::from(Era::Immortal),
frame_system::CheckEra::<Runtime>::from(era),
check_nonce::CheckNonce::<Runtime>::from(nonce).into(),
frame_system::CheckWeight::<Runtime>::new(),
ChargeTransactionPaymentWrapper::new(
Expand Down
Loading