@@ -56,7 +56,6 @@ pub struct FullNodeSimulator {
5656 coin_spends : IndexMap < Bytes32 , CoinSpend > ,
5757 coin_hints : IndexMap < Bytes32 , Bytes32 > ,
5858 mempool : IndexMap < Bytes32 , ValidatedBundle > ,
59- autofarm : bool ,
6059 farming_puzzle_hash : Bytes32 ,
6160 master_secret_key : SecretKey ,
6261 prefarm_puzzle_hash : Bytes32 ,
@@ -254,7 +253,6 @@ impl FullNodeSimulator {
254253 coin_spends : IndexMap :: new ( ) ,
255254 coin_hints : IndexMap :: new ( ) ,
256255 mempool : IndexMap :: new ( ) ,
257- autofarm : true ,
258256 farming_puzzle_hash : prefarm_puzzle_hash,
259257 master_secret_key : root_secret_key,
260258 prefarm_puzzle_hash,
@@ -309,14 +307,6 @@ impl FullNodeSimulator {
309307 self . farming_puzzle_hash = puzzle_hash;
310308 }
311309
312- pub fn get_autofarm ( & self ) -> bool {
313- self . autofarm
314- }
315-
316- pub fn set_autofarm ( & mut self , autofarm : bool ) {
317- self . autofarm = autofarm;
318- }
319-
320310 pub fn get_blockchain_state ( & self ) -> BlockchainStateResponse {
321311 let peak = self
322312 . blocks
@@ -595,9 +585,6 @@ impl FullNodeSimulator {
595585 loop {
596586 let tx_id = spend_bundle. name ( ) ;
597587 if self . mempool . contains_key ( & tx_id) {
598- if self . autofarm {
599- self . farm_block ( 1 ) ;
600- }
601588 return push_tx_success ( ) ;
602589 }
603590
@@ -621,10 +608,6 @@ impl FullNodeSimulator {
621608
622609 match self . insert_mempool_item ( tx_id, validated. clone ( ) ) {
623610 Ok ( ( ) ) => {
624- if self . autofarm {
625- self . farm_block ( 1 ) ;
626- }
627-
628611 return push_tx_success ( ) ;
629612 }
630613 Err ( SimulatorError :: Validation ( ErrorCode :: MempoolConflict ) )
@@ -952,15 +935,24 @@ mod tests {
952935 }
953936
954937 #[ test]
955- fn push_tx_autofarms_by_default ( ) -> anyhow:: Result < ( ) > {
938+ fn push_tx_waits_for_manual_farming ( ) -> anyhow:: Result < ( ) > {
956939 let mut sim = FullNodeSimulator :: new ( ) ;
957940 let ( puzzle_hash, puzzle_reveal) = to_puzzle ( 1 ) ?;
958941 let coin = sim. new_coin ( puzzle_hash, 100 ) ;
959942 let spend_bundle = spend_to_child ( coin, puzzle_reveal, puzzle_hash, 99 ) ?;
960943
961- assert ! ( sim. get_autofarm( ) ) ;
962944 let response = sim. push_tx ( spend_bundle) ;
963945 assert ! ( response. success) ;
946+ assert_eq ! (
947+ sim. get_blockchain_state( )
948+ . blockchain_state
949+ . unwrap( )
950+ . mempool_size,
951+ 1
952+ ) ;
953+ assert_eq ! ( sim. height( ) , 1 ) ;
954+
955+ sim. farm_block ( 1 ) ;
964956 assert_eq ! (
965957 sim. get_blockchain_state( )
966958 . blockchain_state
@@ -990,7 +982,6 @@ mod tests {
990982 #[ test]
991983 fn farm_block_includes_mempool_and_emits_event ( ) -> anyhow:: Result < ( ) > {
992984 let mut sim = FullNodeSimulator :: new ( ) ;
993- sim. set_autofarm ( false ) ;
994985 let ( puzzle_hash, puzzle_reveal) = to_puzzle ( 1 ) ?;
995986 let coin = sim. new_coin ( puzzle_hash, 100 ) ;
996987 let child = Coin :: new ( coin. coin_id ( ) , puzzle_hash, 99 ) ;
@@ -1061,7 +1052,6 @@ mod tests {
10611052 #[ test]
10621053 fn push_tx_accepts_ephemeral_spends_in_same_bundle ( ) -> anyhow:: Result < ( ) > {
10631054 let mut sim = FullNodeSimulator :: new ( ) ;
1064- sim. set_autofarm ( false ) ;
10651055 let ( puzzle_hash, puzzle_reveal) = to_puzzle ( 1 ) ?;
10661056 let parent = sim. new_coin ( puzzle_hash, 100 ) ;
10671057 let child = Coin :: new ( parent. coin_id ( ) , puzzle_hash, 99 ) ;
@@ -1105,40 +1095,6 @@ mod tests {
11051095 Ok ( ( ) )
11061096 }
11071097
1108- #[ test]
1109- fn autofarm_can_be_turned_off_and_on ( ) -> anyhow:: Result < ( ) > {
1110- let mut sim = FullNodeSimulator :: new ( ) ;
1111- let ( puzzle_hash, puzzle_reveal) = to_puzzle ( 1 ) ?;
1112- let coin = sim. new_coin ( puzzle_hash, 100 ) ;
1113- let spend_bundle = spend_to_child ( coin, puzzle_reveal, puzzle_hash, 99 ) ?;
1114-
1115- sim. set_autofarm ( false ) ;
1116- assert ! ( !sim. get_autofarm( ) ) ;
1117- assert ! ( sim. push_tx( spend_bundle. clone( ) ) . success) ;
1118- assert_eq ! (
1119- sim. get_blockchain_state( )
1120- . blockchain_state
1121- . unwrap( )
1122- . mempool_size,
1123- 1
1124- ) ;
1125- assert_eq ! ( sim. height( ) , 1 ) ;
1126-
1127- sim. set_autofarm ( true ) ;
1128- assert ! ( sim. get_autofarm( ) ) ;
1129- assert ! ( sim. push_tx( spend_bundle) . success) ;
1130- assert_eq ! ( sim. height( ) , 2 ) ;
1131- assert_eq ! (
1132- sim. get_blockchain_state( )
1133- . blockchain_state
1134- . unwrap( )
1135- . mempool_size,
1136- 0
1137- ) ;
1138-
1139- Ok ( ( ) )
1140- }
1141-
11421098 #[ test]
11431099 fn revert_removes_farmed_reward ( ) {
11441100 let mut sim = FullNodeSimulator :: new ( ) ;
0 commit comments