@@ -82,7 +82,7 @@ pub struct ApplyEnv<'db> {
8282 pub muts_gas : Vec < consensus_muts:: Mutation > ,
8383 pub muts_rev : Vec < consensus_muts:: Mutation > ,
8484 pub muts_rev_gas : Vec < consensus_muts:: Mutation > ,
85- pub result_log : Vec < HashMap < & ' static str , & ' static str > > ,
85+ pub result_log : Vec < HashMap < String , String > > ,
8686 pub testnet : bool ,
8787 pub testnet_peddlebikes : Vec < Vec < u8 > > ,
8888}
@@ -94,7 +94,7 @@ impl<'db> ApplyEnv<'db> {
9494 Transaction < ' db , TransactionDB < MultiThreaded > > ,
9595 Vec < consensus_muts:: Mutation > ,
9696 Vec < consensus_muts:: Mutation > ,
97- Vec < HashMap < & ' static str , & ' static str > > ,
97+ Vec < HashMap < String , String > > ,
9898 ) {
9999 ( self . txn , self . muts_final , self . muts_final_rev , self . result_log )
100100 }
@@ -140,7 +140,7 @@ pub fn apply_entry<'db, 'a>(db: &'db TransactionDB<MultiThreaded>, pk: &[u8], sk
140140 entry_vr : & [ u8 ; 96 ] , entry_vr_b3 : & [ u8 ; 32 ] , entry_dr : & [ u8 ; 32 ] ,
141141 txus : Vec < rustler:: Term < ' a > > , txn : Transaction < ' db , TransactionDB < MultiThreaded > > ,
142142 testnet : bool , testnet_peddlebikes : Vec < Vec < u8 > > ,
143- ) -> ( Transaction < ' db , TransactionDB < MultiThreaded > > , Vec < consensus_muts:: Mutation > , Vec < consensus_muts:: Mutation > , Vec < HashMap < & ' static str , & ' static str > > ) {
143+ ) -> ( Transaction < ' db , TransactionDB < MultiThreaded > > , Vec < consensus_muts:: Mutation > , Vec < consensus_muts:: Mutation > , Vec < HashMap < String , String > > ) {
144144 let cf_h = db. cf_handle ( "contractstate" ) . unwrap ( ) ;
145145 let cf2_h = db. cf_handle ( "contractstate" ) . unwrap ( ) ;
146146 let cf_tree_h = db. cf_handle ( "contractstate_tree" ) . unwrap ( ) ;
@@ -202,6 +202,7 @@ pub fn apply_entry<'db, 'a>(db: &'db TransactionDB<MultiThreaded>, pk: &[u8], sk
202202 } ) ) ;
203203
204204 let tx_cost = txu. map_get ( crate :: atoms:: tx_cost ( ) ) . unwrap ( ) . decode :: < i128 > ( ) . unwrap ( ) ;
205+ let tx_cost = ( tx_cost as u64 ) . to_string ( ) ;
205206 match res {
206207 Ok ( _) => {
207208 applyenv. muts_final . append ( & mut applyenv. muts ) ;
@@ -232,9 +233,9 @@ pub fn apply_entry<'db, 'a>(db: &'db TransactionDB<MultiThreaded>, pk: &[u8], sk
232233 }
233234*/
234235 let mut m = std:: collections:: HashMap :: new ( ) ;
235- m. insert ( "error" , "ok" ) ;
236+ m. insert ( "error" . to_string ( ) , "ok" . to_string ( ) ) ;
236237 if applyenv. caller_env . entry_height >= 416_00000 {
237- m. insert ( "gas_used" , "0" ) ;
238+ m. insert ( "gas_used" . to_string ( ) , tx_cost . clone ( ) ) ;
238239 }
239240 applyenv. result_log . push ( m) ;
240241 }
@@ -245,18 +246,18 @@ pub fn apply_entry<'db, 'a>(db: &'db TransactionDB<MultiThreaded>, pk: &[u8], sk
245246 consensus_kv:: revert ( & mut applyenv) ;
246247
247248 if let Some ( & s) = payload. downcast_ref :: < & ' static str > ( ) {
248- let mut m: HashMap < & ' static str , & ' static str > = HashMap :: new ( ) ;
249- m. insert ( "error" , s) ;
249+ let mut m = std :: collections :: HashMap :: new ( ) ;
250+ m. insert ( "error" . to_string ( ) , s. to_string ( ) ) ;
250251 if applyenv. caller_env . entry_height >= 416_00000 {
251- m. insert ( "gas_used" , "0" ) ;
252+ m. insert ( "gas_used" . to_string ( ) , tx_cost . clone ( ) ) ;
252253 }
253254 applyenv. result_log . push ( m) ;
254255 } else {
255- let mut m: HashMap < & ' static str , & ' static str > = HashMap :: new ( ) ;
256- m. insert ( "error" , "unknown" ) ;
256+ let mut m = std :: collections :: HashMap :: new ( ) ;
257+ m. insert ( "error" . to_string ( ) , "unknown" . to_string ( ) ) ;
257258 if applyenv. caller_env . entry_height >= 416_00000 {
258259 //(tx_cost as u64).to_string().into_bytes()
259- m. insert ( "gas_used" , "0" ) ;
260+ m. insert ( "gas_used" . to_string ( ) , tx_cost . clone ( ) ) ;
260261 }
261262 applyenv. result_log . push ( m) ;
262263 }
0 commit comments