mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Allow modules to indicate full block. (#1687)
* Add transaction skipping. * Update runtime.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
use crate::{GasSpent, Module, Trait};
|
||||
use balances;
|
||||
use runtime_primitives::BLOCK_FULL;
|
||||
use runtime_primitives::traits::{As, CheckedMul, CheckedSub, Zero};
|
||||
use runtime_support::StorageValue;
|
||||
|
||||
@@ -206,7 +207,8 @@ pub fn buy_gas<T: Trait>(
|
||||
// This cannot underflow since `gas_spent` is never greater than `block_gas_limit`.
|
||||
let gas_available = <Module<T>>::block_gas_limit() - <Module<T>>::gas_spent();
|
||||
if gas_limit > gas_available {
|
||||
return Err("block gas limit is reached");
|
||||
// gas limit reached, revert the transaction and retry again in the future
|
||||
return Err(BLOCK_FULL);
|
||||
}
|
||||
|
||||
// Buy the specified amount of gas.
|
||||
|
||||
Reference in New Issue
Block a user