@@ -3887,7 +3887,7 @@ mod tests {
3887
3887
commit_op. sunset_burn = 5_500 ;
3888
3888
commit_op. burn_fee = 110_000 ;
3889
3889
3890
- let tx = btc_controller
3890
+ let ser_tx = btc_controller
3891
3891
. make_operation_tx (
3892
3892
StacksEpochId :: Epoch31 ,
3893
3893
BlockstackOperationType :: LeaderBlockCommit ( commit_op) ,
@@ -3899,7 +3899,7 @@ mod tests {
3899
3899
3900
3900
assert_eq ! (
3901
3901
"01000000014d9e9dc7d126446e90dd013f023937eba9cb2c88f4d12707400a3ede994a62c5000000008b483045022100e4f934cf20a42ae5709f96505b73ad4e7ab19f41931940257089bfe6935840780220503af1cafd02e42ed008ad473dd619ee591d6926333413275168cf2697ce91430141044227d7e5c0997524ce011c126f0464d43e7518872a9b1ad29436ac5142d73eab5fb48d764676900fc2fac56917412114bf7dfafe51f715cf466fe0c1a6c69d11fdffffff047c15000000000000536a4c5054335be88c3d30cb59a142f83de3b27f897a43bbb0f13316911bb98a3229973dae32afd5b9f21bc1f40f24e2c101ecd13c55b8619e5e03dad81de2c62a1cc1d8c1b375000008a300010000059800015ad8d60000000000001976a914000000000000000000000000000000000000000088acd8d60000000000001976a914000000000000000000000000000000000000000088acd4e3032a010000001976a9145e52c53cb96b55f0e3d719adbca21005bc54cb2e88ac00000000" ,
3902
- tx . to_hex( )
3902
+ ser_tx . to_hex( )
3903
3903
) ;
3904
3904
}
3905
3905
@@ -3930,7 +3930,7 @@ mod tests {
3930
3930
3931
3931
let leader_key_op = utils:: create_templated_leader_key_op ( ) ;
3932
3932
3933
- let tx = btc_controller
3933
+ let ser_tx = btc_controller
3934
3934
. make_operation_tx (
3935
3935
StacksEpochId :: Epoch31 ,
3936
3936
BlockstackOperationType :: LeaderKeyRegister ( leader_key_op) ,
@@ -3942,7 +3942,102 @@ mod tests {
3942
3942
3943
3943
assert_eq ! (
3944
3944
"01000000014d9e9dc7d126446e90dd013f023937eba9cb2c88f4d12707400a3ede994a62c5000000008b483045022100c8694688b4269585ef63bfeb96d017bafae02621ebd0b5012e7564d3efcb71f70220070528674f75ca3503246030f064a85d2010256336372b246100f29ba21bf28b0141044227d7e5c0997524ce011c126f0464d43e7518872a9b1ad29436ac5142d73eab5fb48d764676900fc2fac56917412114bf7dfafe51f715cf466fe0c1a6c69d11fdffffff020000000000000000396a3754335e00000000000000000000000000000000000000003b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29e0a3052a010000001976a9145e52c53cb96b55f0e3d719adbca21005bc54cb2e88ac00000000" ,
3945
- tx. to_hex( )
3945
+ ser_tx. to_hex( )
3946
+ ) ;
3947
+ }
3948
+ }
3949
+
3950
+ /// Tests related to `BitcoinRegtestController::submit_operation`
3951
+ mod submit_operation {
3952
+ use super :: * ;
3953
+
3954
+ #[ test]
3955
+ #[ ignore]
3956
+ fn test_submit_leader_block_commit_tx_ok ( ) {
3957
+ if env:: var ( "BITCOIND_TEST" ) != Ok ( "1" . into ( ) ) {
3958
+ return ;
3959
+ }
3960
+
3961
+ let keychain = utils:: create_keychain ( ) ;
3962
+ let miner_pubkey = keychain. get_pub_key ( ) ;
3963
+ let mut op_signer = keychain. generate_op_signer ( ) ;
3964
+
3965
+ let mut config = utils:: create_config ( ) ;
3966
+ config. burnchain . local_mining_public_key = Some ( miner_pubkey. to_hex ( ) ) ;
3967
+
3968
+ let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3969
+ btcd_controller
3970
+ . start_bitcoind ( )
3971
+ . expect ( "bitcoind should be started!" ) ;
3972
+
3973
+ let mut btc_controller = BitcoinRegtestController :: new ( config. clone ( ) , None ) ;
3974
+ btc_controller
3975
+ . connect_dbs ( )
3976
+ . expect ( "Dbs initialization required!" ) ;
3977
+ btc_controller. bootstrap_chain ( 101 ) ; // now, one utxo exists
3978
+
3979
+ let mut commit_op = utils:: create_templated_commit_op ( ) ;
3980
+ commit_op. sunset_burn = 5_500 ;
3981
+ commit_op. burn_fee = 110_000 ;
3982
+
3983
+ let tx_id = btc_controller
3984
+ . submit_operation (
3985
+ StacksEpochId :: Epoch31 ,
3986
+ BlockstackOperationType :: LeaderBlockCommit ( commit_op) ,
3987
+ & mut op_signer,
3988
+ 0 ,
3989
+ )
3990
+ . expect ( "Build leader block commit should work" ) ;
3991
+
3992
+ assert ! ( op_signer. is_disposed( ) ) ;
3993
+
3994
+ assert_eq ! (
3995
+ "1a74106bd760117892fbd90fca11646b4de46f99fd2b065c9e0706cfdcea0336" ,
3996
+ tx_id. to_hex( )
3997
+ ) ;
3998
+ }
3999
+
4000
+ #[ test]
4001
+ #[ ignore]
4002
+ fn test_submit_operation_leader_key_register_tx_ok ( ) {
4003
+ if env:: var ( "BITCOIND_TEST" ) != Ok ( "1" . into ( ) ) {
4004
+ return ;
4005
+ }
4006
+
4007
+ let keychain = utils:: create_keychain ( ) ;
4008
+ let miner_pubkey = keychain. get_pub_key ( ) ;
4009
+ let mut op_signer = keychain. generate_op_signer ( ) ;
4010
+
4011
+ let mut config = utils:: create_config ( ) ;
4012
+ config. burnchain . local_mining_public_key = Some ( miner_pubkey. to_hex ( ) ) ;
4013
+
4014
+ let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
4015
+ btcd_controller
4016
+ . start_bitcoind ( )
4017
+ . expect ( "bitcoind should be started!" ) ;
4018
+
4019
+ let mut btc_controller = BitcoinRegtestController :: new ( config. clone ( ) , None ) ;
4020
+ btc_controller
4021
+ . connect_dbs ( )
4022
+ . expect ( "Dbs initialization required!" ) ;
4023
+ btc_controller. bootstrap_chain ( 101 ) ; // now, one utxo exists
4024
+
4025
+ let leader_key_op = utils:: create_templated_leader_key_op ( ) ;
4026
+
4027
+ let tx_id = btc_controller
4028
+ . submit_operation (
4029
+ StacksEpochId :: Epoch31 ,
4030
+ BlockstackOperationType :: LeaderKeyRegister ( leader_key_op) ,
4031
+ & mut op_signer,
4032
+ 0
4033
+ )
4034
+ . expect ( "Build leader block commit should work" ) ;
4035
+
4036
+ assert ! ( op_signer. is_disposed( ) ) ;
4037
+
4038
+ assert_eq ! (
4039
+ "4ecd7ba71bebd1aaed49dd63747ee424473f1c571bb9a576361607a669191024" ,
4040
+ tx_id. to_hex( )
3946
4041
) ;
3947
4042
}
3948
4043
}
0 commit comments