File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
sugondat/chain/pallets/length-fee-adjustment/src Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ pub mod pallet {
6262
6363 /// Configure the pallet by specifying the parameters and types on which it depends.
6464 #[ pallet:: config]
65- pub trait Config : frame_system:: Config + pallet_transaction_payment:: Config {
65+ pub trait Config : frame_system:: Config + pallet_transaction_payment:: Config + cumulus_pallet_parachain_system :: Config {
6666 // `targeted_length_fee_adjustment` parameters
6767 #[ pallet:: constant]
6868 type TransactionByteFee : Get < <<Self as pallet_transaction_payment:: Config >:: OnChargeTransaction as OnChargeTransaction < Self > >:: Balance > ;
@@ -217,16 +217,11 @@ pub mod pallet {
217217 impl < T : Config > OnSystemEvent for Pallet < T > {
218218 fn on_validation_data ( data : & PersistedValidationData ) {
219219 let relay_block_number = data. relay_parent_number ;
220+ let prev_relay_block_number = cumulus_pallet_parachain_system:: Pallet :: < T > :: last_relay_block_number ( ) ;
220221
221- let prev_relay_block_number = PrevRelayBlockNumber :: < T > :: get ( ) ;
222- PrevRelayBlockNumber :: < T > :: put ( relay_block_number) ;
223-
224- // if nothing was already present then this is the first block to
225- // be executed with the fee adjustment so nothing should be done
226- let prev_relay_block_number = match prev_relay_block_number {
227- Some ( prev) => prev,
228- None => return ,
229- } ;
222+ // a value of zero here implies this is the first block of the parachain. no need
223+ // to do a massive fee update.
224+ if prev_relay_block_number == Zero :: zero ( ) { return }
230225
231226 // It should never be negative because the relay_block_number is surely
232227 // greater than the para_block_number.
You can’t perform that action at this time.
0 commit comments