File tree Expand file tree Collapse file tree 1 file changed +77
-0
lines changed Expand file tree Collapse file tree 1 file changed +77
-0
lines changed Original file line number Diff line number Diff line change @@ -12798,6 +12798,83 @@ fn test_sip_031_activation() {
12798
12798
} ) )
12799
12799
) ;
12800
12800
12801
+ // check if the coinbase activation block receipt has the mint event
12802
+ let mut mint_event_found: Option < serde_json:: Value > = None ;
12803
+ let mut coinbase_txid: Option < String > = None ;
12804
+ for block in test_observer:: get_blocks ( ) . iter ( ) . rev ( ) {
12805
+ let burn_block_height = block. get ( "burn_block_height" ) . unwrap ( ) . as_u64 ( ) . unwrap ( ) ;
12806
+ if burn_block_height
12807
+ == naka_conf. burnchain . epochs . clone ( ) . unwrap ( ) [ StacksEpochId :: Epoch32 ] . start_height
12808
+ {
12809
+ // the first transaction is the coinbase
12810
+ coinbase_txid = Some (
12811
+ block
12812
+ . get ( "transactions" )
12813
+ . unwrap ( )
12814
+ . as_array ( )
12815
+ . unwrap ( )
12816
+ . first ( )
12817
+ . unwrap ( )
12818
+ . get ( "txid" )
12819
+ . unwrap ( )
12820
+ . as_str ( )
12821
+ . unwrap ( )
12822
+ . into ( ) ,
12823
+ ) ;
12824
+ let events = block. get ( "events" ) . unwrap ( ) . as_array ( ) . unwrap ( ) ;
12825
+ for event in events {
12826
+ if let Some ( _) = event. get ( "stx_mint_event" ) {
12827
+ mint_event_found = Some ( event. clone ( ) ) ;
12828
+ break ;
12829
+ }
12830
+ }
12831
+ break ;
12832
+ }
12833
+ }
12834
+
12835
+ assert ! ( coinbase_txid. is_some( ) ) ;
12836
+ assert ! ( mint_event_found. is_some( ) ) ;
12837
+
12838
+ // check the amount
12839
+ assert_eq ! (
12840
+ mint_event_found
12841
+ . clone( )
12842
+ . unwrap( )
12843
+ . get( "stx_mint_event" )
12844
+ . unwrap( )
12845
+ . get( "amount" )
12846
+ . unwrap( )
12847
+ . as_str( )
12848
+ . unwrap( ) ,
12849
+ "200000000000000"
12850
+ ) ;
12851
+
12852
+ // check the recipient
12853
+ assert_eq ! (
12854
+ mint_event_found
12855
+ . clone( )
12856
+ . unwrap( )
12857
+ . get( "stx_mint_event" )
12858
+ . unwrap( )
12859
+ . get( "recipient" )
12860
+ . unwrap( )
12861
+ . as_str( )
12862
+ . unwrap( ) ,
12863
+ boot_code_id( SIP_031_NAME , naka_conf. is_mainnet( ) ) . to_string( )
12864
+ ) ;
12865
+
12866
+ // check the txid
12867
+ assert_eq ! (
12868
+ mint_event_found
12869
+ . clone( )
12870
+ . unwrap( )
12871
+ . get( "txid" )
12872
+ . unwrap( )
12873
+ . as_str( )
12874
+ . unwrap( ) ,
12875
+ coinbase_txid. unwrap( )
12876
+ ) ;
12877
+
12801
12878
coord_channel
12802
12879
. lock ( )
12803
12880
. expect ( "Mutex poisoned" )
You can’t perform that action at this time.
0 commit comments