@@ -1509,7 +1509,6 @@ impl BitcoinRegtestController {
1509
1509
epoch_id : StacksEpochId ,
1510
1510
payload : LeaderBlockCommitOp ,
1511
1511
signer : & mut BurnchainOpSigner ,
1512
- _attempt : u64 ,
1513
1512
) -> Result < Transaction , BurnchainControllerError > {
1514
1513
// Are we currently tracking an operation?
1515
1514
if self . ongoing_block_commit . is_none ( ) || !self . allow_rbf {
@@ -2069,7 +2068,7 @@ impl BitcoinRegtestController {
2069
2068
) -> Result < SerializedTx , BurnchainControllerError > {
2070
2069
let transaction = match operation {
2071
2070
BlockstackOperationType :: LeaderBlockCommit ( payload) => {
2072
- self . build_leader_block_commit_tx ( epoch_id, payload, op_signer, attempt )
2071
+ self . build_leader_block_commit_tx ( epoch_id, payload, op_signer)
2073
2072
}
2074
2073
BlockstackOperationType :: LeaderKeyRegister ( payload) => {
2075
2074
self . build_leader_key_register_tx ( epoch_id, payload, op_signer, attempt)
@@ -3517,12 +3516,7 @@ mod tests {
3517
3516
commit_op. burn_fee = 110_000 ;
3518
3517
3519
3518
let tx = btc_controller
3520
- . build_leader_block_commit_tx (
3521
- StacksEpochId :: Epoch31 ,
3522
- commit_op. clone ( ) ,
3523
- & mut op_signer,
3524
- 0 ,
3525
- )
3519
+ . build_leader_block_commit_tx ( StacksEpochId :: Epoch31 , commit_op. clone ( ) , & mut op_signer)
3526
3520
. expect ( "Build leader block commit should work" ) ;
3527
3521
3528
3522
assert ! ( op_signer. is_disposed( ) ) ;
@@ -3575,20 +3569,14 @@ mod tests {
3575
3569
let commit_op = utils:: create_templated_commit_op ( ) ;
3576
3570
3577
3571
let _first_tx_ok = btc_controller
3578
- . build_leader_block_commit_tx (
3579
- StacksEpochId :: Epoch31 ,
3580
- commit_op. clone ( ) ,
3581
- & mut op_signer,
3582
- 0 ,
3583
- )
3572
+ . build_leader_block_commit_tx ( StacksEpochId :: Epoch31 , commit_op. clone ( ) , & mut op_signer)
3584
3573
. expect ( "At first, building leader block commit should work" ) ;
3585
3574
3586
3575
// re-submitting same commit while previous it is not confirmed by the burnchain
3587
3576
let resubmit = btc_controller. build_leader_block_commit_tx (
3588
3577
StacksEpochId :: Epoch31 ,
3589
3578
commit_op,
3590
3579
& mut op_signer,
3591
- 0 ,
3592
3580
) ;
3593
3581
3594
3582
assert ! ( resubmit. is_err( ) ) ;
@@ -3626,12 +3614,7 @@ mod tests {
3626
3614
let commit_op = utils:: create_templated_commit_op ( ) ;
3627
3615
3628
3616
let first_tx_ok = btc_controller
3629
- . build_leader_block_commit_tx (
3630
- StacksEpochId :: Epoch31 ,
3631
- commit_op. clone ( ) ,
3632
- & mut op_signer,
3633
- 0 ,
3634
- )
3617
+ . build_leader_block_commit_tx ( StacksEpochId :: Epoch31 , commit_op. clone ( ) , & mut op_signer)
3635
3618
. expect ( "At first, building leader block commit should work" ) ;
3636
3619
3637
3620
utils:: mine_tx ( & btc_controller, first_tx_ok) ; // Now tx is confirmed
@@ -3641,7 +3624,6 @@ mod tests {
3641
3624
StacksEpochId :: Epoch31 ,
3642
3625
commit_op,
3643
3626
& mut op_signer,
3644
- 0 ,
3645
3627
) ;
3646
3628
3647
3629
assert ! ( resubmit. is_err( ) ) ;
@@ -3681,12 +3663,7 @@ mod tests {
3681
3663
commit_op. burn_fee = 110_000 ;
3682
3664
3683
3665
let first_tx_ok = btc_controller
3684
- . build_leader_block_commit_tx (
3685
- StacksEpochId :: Epoch31 ,
3686
- commit_op. clone ( ) ,
3687
- & mut op_signer,
3688
- 0 ,
3689
- )
3666
+ . build_leader_block_commit_tx ( StacksEpochId :: Epoch31 , commit_op. clone ( ) , & mut op_signer)
3690
3667
. expect ( "At first, building leader block commit should work" ) ;
3691
3668
3692
3669
let first_txid = first_tx_ok. txid ( ) ;
@@ -3700,7 +3677,7 @@ mod tests {
3700
3677
commit_op. burn_fee += 10 ;
3701
3678
3702
3679
let rbf_tx = btc_controller
3703
- . build_leader_block_commit_tx ( StacksEpochId :: Epoch31 , commit_op. clone ( ) , & mut signer, 0 )
3680
+ . build_leader_block_commit_tx ( StacksEpochId :: Epoch31 , commit_op. clone ( ) , & mut signer)
3704
3681
. expect ( "Commit tx should be rbf-ed" ) ;
3705
3682
3706
3683
assert ! ( op_signer. is_disposed( ) ) ;
@@ -3761,12 +3738,7 @@ mod tests {
3761
3738
commit_op. burn_fee = 110_000 ;
3762
3739
3763
3740
let _first_tx_ok = btc_controller
3764
- . build_leader_block_commit_tx (
3765
- StacksEpochId :: Epoch31 ,
3766
- commit_op. clone ( ) ,
3767
- & mut op_signer,
3768
- 0 ,
3769
- )
3741
+ . build_leader_block_commit_tx ( StacksEpochId :: Epoch31 , commit_op. clone ( ) , & mut op_signer)
3770
3742
. expect ( "At first, building leader block commit should work" ) ;
3771
3743
3772
3744
//re-gen signer othewise fails because it will be disposed during previous commit tx.
@@ -3775,7 +3747,7 @@ mod tests {
3775
3747
commit_op. burn_fee += 10 ;
3776
3748
3777
3749
let rbf_tx = btc_controller
3778
- . build_leader_block_commit_tx ( StacksEpochId :: Epoch31 , commit_op. clone ( ) , & mut signer, 0 )
3750
+ . build_leader_block_commit_tx ( StacksEpochId :: Epoch31 , commit_op. clone ( ) , & mut signer)
3779
3751
. expect ( "Commit tx should be rbf-ed" ) ;
3780
3752
3781
3753
assert ! ( op_signer. is_disposed( ) ) ;
@@ -3800,4 +3772,55 @@ mod tests {
3800
3772
assert_eq ! ( op_commit_2, rbf_tx. output[ 2 ] ) ;
3801
3773
assert_eq ! ( op_change, rbf_tx. output[ 3 ] ) ;
3802
3774
}
3775
+
3776
+ /// Tests related to `BitcoinRegtestController::make_operation_tx`
3777
+ mod make_operation {
3778
+ use super :: * ;
3779
+
3780
+ #[ test]
3781
+ #[ ignore]
3782
+ fn test_make_operation_leader_block_commit_tx_ok ( ) {
3783
+ if env:: var ( "BITCOIND_TEST" ) != Ok ( "1" . into ( ) ) {
3784
+ return ;
3785
+ }
3786
+
3787
+ let keychain = utils:: create_keychain ( ) ;
3788
+ let miner_pubkey = keychain. get_pub_key ( ) ;
3789
+ let mut op_signer = keychain. generate_op_signer ( ) ;
3790
+
3791
+ let mut config = utils:: create_config ( ) ;
3792
+ config. burnchain . local_mining_public_key = Some ( miner_pubkey. to_hex ( ) ) ;
3793
+
3794
+ let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3795
+ btcd_controller
3796
+ . start_bitcoind ( )
3797
+ . expect ( "bitcoind should be started!" ) ;
3798
+
3799
+ let mut btc_controller = BitcoinRegtestController :: new ( config. clone ( ) , None ) ;
3800
+ btc_controller
3801
+ . connect_dbs ( )
3802
+ . expect ( "Dbs initialization required!" ) ;
3803
+ btc_controller. bootstrap_chain ( 101 ) ; // now, one utxo exists
3804
+
3805
+ let mut commit_op = utils:: create_templated_commit_op ( ) ;
3806
+ commit_op. sunset_burn = 5_500 ;
3807
+ commit_op. burn_fee = 110_000 ;
3808
+
3809
+ let tx = btc_controller
3810
+ . make_operation_tx (
3811
+ StacksEpochId :: Epoch31 ,
3812
+ BlockstackOperationType :: LeaderBlockCommit ( commit_op) ,
3813
+ & mut op_signer,
3814
+ 0 ,
3815
+ )
3816
+ . expect ( "Build leader block commit should work" ) ;
3817
+
3818
+ assert ! ( op_signer. is_disposed( ) ) ;
3819
+
3820
+ assert_eq ! (
3821
+ "01000000014d9e9dc7d126446e90dd013f023937eba9cb2c88f4d12707400a3ede994a62c5000000008b483045022100e4f934cf20a42ae5709f96505b73ad4e7ab19f41931940257089bfe6935840780220503af1cafd02e42ed008ad473dd619ee591d6926333413275168cf2697ce91430141044227d7e5c0997524ce011c126f0464d43e7518872a9b1ad29436ac5142d73eab5fb48d764676900fc2fac56917412114bf7dfafe51f715cf466fe0c1a6c69d11fdffffff047c15000000000000536a4c5054335be88c3d30cb59a142f83de3b27f897a43bbb0f13316911bb98a3229973dae32afd5b9f21bc1f40f24e2c101ecd13c55b8619e5e03dad81de2c62a1cc1d8c1b375000008a300010000059800015ad8d60000000000001976a914000000000000000000000000000000000000000088acd8d60000000000001976a914000000000000000000000000000000000000000088acd4e3032a010000001976a9145e52c53cb96b55f0e3d719adbca21005bc54cb2e88ac00000000" ,
3822
+ tx. to_hex( )
3823
+ ) ;
3824
+ }
3825
+ }
3803
3826
}
0 commit comments