Skip to content

Commit 79503a1

Browse files
authored
Follow substrate executive (paritytech#533)
1 parent 8037f92 commit 79503a1

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

cli/src/chainx_runtime.compact.wasm

-359 Bytes
Binary file not shown.

runtime/src/xexecutive.rs

+10-12
Original file line numberDiff line numberDiff line change
@@ -302,24 +302,22 @@ impl<
302302

303303
let valid = if let (Some(sender), Some(index), Some(acceleration)) = (xt.sender(), xt.index(), xt.acceleration()) {
304304
// check index
305-
let mut expected_index = <system::Module<System>>::account_nonce(sender);
305+
let expected_index = <system::Module<System>>::account_nonce(sender);
306306
if index < &expected_index {
307307
return TransactionValidity::Invalid(ApplyError::Stale as i8);
308308
}
309-
if *index > expected_index + As::sa(256) {
310-
return TransactionValidity::Unknown(ApplyError::Future as i8);
311-
}
312-
313-
let mut deps = Vec::new();
314-
while expected_index < *index {
315-
deps.push((sender, expected_index).encode());
316-
expected_index = expected_index + One::one();
317-
}
309+
let index = *index;
310+
let provides = vec![(sender, index).encode()];
311+
let requires = if expected_index < index {
312+
vec![(sender, index - One::one()).encode()]
313+
} else {
314+
vec![]
315+
};
318316

319317
TransactionValidity::Valid {
320318
priority: acceleration.as_() as TransactionPriority,
321-
requires: deps,
322-
provides: vec![(sender, *index).encode()],
319+
requires,
320+
provides,
323321
longevity: TransactionLongevity::max_value(),
324322
}
325323
} else {
Binary file not shown.

0 commit comments

Comments
 (0)