File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
core/src/consensus/tendermint Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ use std::sync::{Arc, Weak};
2424use ckey:: { public_to_address, Address } ;
2525use cnetwork:: NetworkService ;
2626use crossbeam_channel as crossbeam;
27- use cstate:: { ActionHandler , TopStateView } ;
27+ use cstate:: { ActionHandler , TopState , TopStateView } ;
2828use ctypes:: { BlockHash , CommonParams , Header } ;
2929use num_rational:: Ratio ;
3030
@@ -238,6 +238,14 @@ impl ConsensusEngine for Tendermint {
238238
239239 stake:: on_term_close ( block. state_mut ( ) , block_number, & inactive_validators) ?;
240240
241+ match term {
242+ 0 => { }
243+ _ => match term_common_params. expect ( "Term common params should exist" ) . era ( ) {
244+ 0 => { }
245+ 1 => block. state_mut ( ) . snapshot_term_params ( ) ?,
246+ _ => unimplemented ! ( "It is not decided how we handle this" ) ,
247+ } ,
248+ }
241249 Ok ( ( ) )
242250 }
243251
Original file line number Diff line number Diff line change @@ -999,6 +999,12 @@ impl TopState for TopLevelState {
999999 metadata. increase_seq ( ) ;
10001000 Ok ( ( ) )
10011001 }
1002+
1003+ fn snapshot_term_params ( & mut self ) -> StateResult < ( ) > {
1004+ let mut metadata = self . get_metadata_mut ( ) ?;
1005+ metadata. snapshot_term_params ( ) ;
1006+ Ok ( ( ) )
1007+ }
10021008}
10031009
10041010fn is_active_account ( state : & dyn TopStateView , address : & Address ) -> TrieResult < bool > {
Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ pub trait TopState {
183183 fn remove_action_data ( & mut self , key : & H256 ) ;
184184
185185 fn update_params ( & mut self , metadata_seq : u64 , params : CommonParams ) -> StateResult < ( ) > ;
186+ fn snapshot_term_params ( & mut self ) -> StateResult < ( ) > ;
186187}
187188
188189pub trait StateWithCache {
You can’t perform that action at this time.
0 commit comments