@@ -95,18 +95,15 @@ pub struct ConfigFile {
95
95
pub burnchain : Option < BurnchainConfigFile > ,
96
96
pub node : Option < NodeConfigFile > ,
97
97
pub ustx_balance : Option < Vec < InitialBalanceFile > > ,
98
+ /// Deprecated: use `ustx_balance` instead
99
+ pub mstx_balance : Option < Vec < InitialBalanceFile > > ,
98
100
pub events_observer : Option < HashSet < EventObserverConfigFile > > ,
99
101
pub connection_options : Option < ConnectionOptionsFile > ,
100
102
pub fee_estimation : Option < FeeEstimationConfigFile > ,
101
103
pub miner : Option < MinerConfigFile > ,
102
104
pub atlas : Option < AtlasConfigFile > ,
103
105
}
104
106
105
- #[ derive( Clone , Deserialize , Default ) ]
106
- pub struct LegacyMstxConfigFile {
107
- pub mstx_balance : Option < Vec < InitialBalanceFile > > ,
108
- }
109
-
110
107
impl ConfigFile {
111
108
pub fn from_path ( path : & str ) -> Result < ConfigFile , String > {
112
109
let content = fs:: read_to_string ( path) . map_err ( |e| format ! ( "Invalid path: {}" , & e) ) ?;
@@ -118,13 +115,16 @@ impl ConfigFile {
118
115
pub fn from_str ( content : & str ) -> Result < ConfigFile , String > {
119
116
let mut config: ConfigFile =
120
117
toml:: from_str ( content) . map_err ( |e| format ! ( "Invalid toml: {}" , e) ) ?;
121
- let legacy_config: LegacyMstxConfigFile = toml:: from_str ( content) . unwrap ( ) ;
122
- if let Some ( mstx_balance) = legacy_config. mstx_balance {
123
- warn ! ( "'mstx_balance' inside toml config is deprecated, replace with 'ustx_balance'" ) ;
124
- config. ustx_balance = match config. ustx_balance {
125
- Some ( balance) => Some ( [ balance, mstx_balance] . concat ( ) ) ,
126
- None => Some ( mstx_balance) ,
127
- } ;
118
+ if let Some ( mstx_balance) = config. mstx_balance . take ( ) {
119
+ warn ! ( "'mstx_balance' in the config is deprecated; please use 'ustx_balance' instead." ) ;
120
+ match config. ustx_balance {
121
+ Some ( ref mut ustx_balance) => {
122
+ ustx_balance. extend ( mstx_balance) ;
123
+ }
124
+ None => {
125
+ config. ustx_balance = Some ( mstx_balance) ;
126
+ }
127
+ }
128
128
}
129
129
Ok ( config)
130
130
}
0 commit comments