@@ -11175,3 +11175,79 @@ fn injected_signatures_are_ignored_across_boundaries() {
11175
11175
11176
11176
assert ! ( new_spawned_signer. stop( ) . is_none( ) ) ;
11177
11177
}
11178
+
11179
+ #[ test]
11180
+ #[ ignore]
11181
+ fn fast_sortition ( ) {
11182
+ if env:: var ( "BITCOIND_TEST" ) != Ok ( "1" . into ( ) ) {
11183
+ return ;
11184
+ }
11185
+
11186
+ info ! ( "------------------------- Test Setup -------------------------" ) ;
11187
+ let num_signers = 5 ;
11188
+ let sender_sk = Secp256k1PrivateKey :: new ( ) ;
11189
+ let sender_addr = tests:: to_addr ( & sender_sk) ;
11190
+ let mut sender_nonce = 0 ;
11191
+ let send_amt = 100 ;
11192
+ let send_fee = 400 ;
11193
+ let num_transfers = 3 ;
11194
+ let recipient = PrincipalData :: from ( StacksAddress :: burn_address ( false ) ) ;
11195
+ let mut signer_test: SignerTest < SpawnedSigner > = SignerTest :: new (
11196
+ num_signers,
11197
+ vec ! [ ( sender_addr, num_transfers * ( send_amt + send_fee) ) ] ,
11198
+ ) ;
11199
+
11200
+ let http_origin = format ! ( "http://{}" , & signer_test. running_nodes. conf. node. rpc_bind) ;
11201
+
11202
+ signer_test. boot_to_epoch_3 ( ) ;
11203
+
11204
+ info ! ( "------------------------- Mine a Block -------------------------" ) ;
11205
+ let transfer_tx = make_stacks_transfer (
11206
+ & sender_sk,
11207
+ sender_nonce,
11208
+ send_fee,
11209
+ signer_test. running_nodes . conf . burnchain . chain_id ,
11210
+ & recipient,
11211
+ send_amt,
11212
+ ) ;
11213
+ submit_tx ( & http_origin, & transfer_tx) ;
11214
+ sender_nonce += 1 ;
11215
+
11216
+ wait_for ( 60 , || {
11217
+ Ok ( get_account ( & http_origin, & sender_addr) . nonce == sender_nonce)
11218
+ } )
11219
+ . expect ( "Timed out waiting for call tx to be mined" ) ;
11220
+
11221
+ info ! ( "------------------------- Cause a missed sortition -------------------------" ) ;
11222
+
11223
+ signer_test
11224
+ . running_nodes
11225
+ . btc_regtest_controller
11226
+ . build_next_block ( 1 ) ;
11227
+ next_block_and_process_new_stacks_block (
11228
+ & mut signer_test. running_nodes . btc_regtest_controller ,
11229
+ 60 ,
11230
+ & signer_test. running_nodes . coord_channel ,
11231
+ )
11232
+ . expect ( "Failed to mine a block" ) ;
11233
+
11234
+ info ! ( "------------------------- Mine a Block -------------------------" ) ;
11235
+ let transfer_tx = make_stacks_transfer (
11236
+ & sender_sk,
11237
+ sender_nonce,
11238
+ send_fee,
11239
+ signer_test. running_nodes . conf . burnchain . chain_id ,
11240
+ & recipient,
11241
+ send_amt,
11242
+ ) ;
11243
+ submit_tx ( & http_origin, & transfer_tx) ;
11244
+ sender_nonce += 1 ;
11245
+
11246
+ wait_for ( 60 , || {
11247
+ Ok ( get_account ( & http_origin, & sender_addr) . nonce == sender_nonce)
11248
+ } )
11249
+ . expect ( "Timed out waiting for call tx to be mined" ) ;
11250
+
11251
+ info ! ( "------------------------- Shutdown -------------------------" ) ;
11252
+ signer_test. shutdown ( ) ;
11253
+ }
0 commit comments