Skip to content

Commit 860c6ff

Browse files
committed
refactor: remove attempt arg from submit_operation
1 parent 1cfc857 commit 860c6ff

File tree

11 files changed

+29
-56
lines changed

11 files changed

+29
-56
lines changed

testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,7 +2253,6 @@ impl BurnchainController for BitcoinRegtestController {
22532253
epoch_id: StacksEpochId,
22542254
operation: BlockstackOperationType,
22552255
op_signer: &mut BurnchainOpSigner,
2256-
_attempt: u64,
22572256
) -> Result<Txid, BurnchainControllerError> {
22582257
let transaction = self.make_operation_tx(epoch_id, operation, op_signer)?;
22592258
self.send_transaction(transaction)
@@ -2836,7 +2835,7 @@ mod tests {
28362835
use std::io::Write;
28372836

28382837
use stacks::burnchains::BurnchainSigner;
2839-
use stacks::config::{DEFAULT_SATS_PER_VB};
2838+
use stacks::config::DEFAULT_SATS_PER_VB;
28402839
use stacks_common::deps_common::bitcoin::blockdata::script::Builder;
28412840
use stacks_common::types::chainstate::{BlockHeaderHash, StacksAddress, VRFSeed};
28422841
use stacks_common::util::hash::to_hex;
@@ -3053,11 +3052,12 @@ mod tests {
30533052
tx.input[index].clone()
30543053
}
30553054

3056-
30573055
pub fn create_templated_leader_key_op() -> LeaderKeyRegisterOp {
30583056
LeaderKeyRegisterOp {
30593057
consensus_hash: ConsensusHash([0u8; 20]),
3060-
public_key: VRFPublicKey::from_private(&VRFPrivateKey::from_bytes(&[0u8; 32]).unwrap()),
3058+
public_key: VRFPublicKey::from_private(
3059+
&VRFPrivateKey::from_bytes(&[0u8; 32]).unwrap(),
3060+
),
30613061
memo: vec![],
30623062
txid: Txid([3u8; 32]),
30633063
vtxindex: 0,
@@ -3066,7 +3066,11 @@ mod tests {
30663066
}
30673067
}
30683068

3069-
pub fn txout_opreturn_v2<T: StacksMessageCodec>(op: &T, magic: &MagicBytes, value: u64) -> TxOut {
3069+
pub fn txout_opreturn_v2<T: StacksMessageCodec>(
3070+
op: &T,
3071+
magic: &MagicBytes,
3072+
value: u64,
3073+
) -> TxOut {
30703074
let op_bytes = {
30713075
let mut buffer = vec![];
30723076
let mut magic_bytes = magic.as_bytes().to_vec();
@@ -3083,7 +3087,7 @@ mod tests {
30833087
.push_slice(&op_bytes)
30843088
.into_script(),
30853089
}
3086-
}
3090+
}
30873091
}
30883092

30893093
#[test]
@@ -3831,9 +3835,13 @@ mod tests {
38313835
btc_controller.bootstrap_chain(101); // now, one utxo exists
38323836

38333837
let leader_key_op = utils::create_templated_leader_key_op();
3834-
3838+
38353839
let tx = btc_controller
3836-
.build_leader_key_register_tx(StacksEpochId::Epoch31, leader_key_op.clone(), &mut op_signer)
3840+
.build_leader_key_register_tx(
3841+
StacksEpochId::Epoch31,
3842+
leader_key_op.clone(),
3843+
&mut op_signer,
3844+
)
38373845
.expect("Build leader key should work");
38383846

38393847
assert!(op_signer.is_disposed());
@@ -3854,7 +3862,7 @@ mod tests {
38543862
assert_eq!(op_change, tx.output[1]);
38553863
}
38563864

3857-
/// Tests related to `BitcoinRegtestController::make_operation_tx`
3865+
/// Tests related to `BitcoinRegtestController::make_operation_tx`
38583866
mod make_operation {
38593867
use super::*;
38603868

@@ -3929,7 +3937,7 @@ mod tests {
39293937
btc_controller.bootstrap_chain(101); // now, one utxo exists
39303938

39313939
let leader_key_op = utils::create_templated_leader_key_op();
3932-
3940+
39333941
let ser_tx = btc_controller
39343942
.make_operation_tx(
39353943
StacksEpochId::Epoch31,
@@ -3947,7 +3955,7 @@ mod tests {
39473955
}
39483956
}
39493957

3950-
/// Tests related to `BitcoinRegtestController::submit_operation`
3958+
/// Tests related to `BitcoinRegtestController::submit_operation`
39513959
mod submit_operation {
39523960
use super::*;
39533961

@@ -3985,7 +3993,6 @@ mod tests {
39853993
StacksEpochId::Epoch31,
39863994
BlockstackOperationType::LeaderBlockCommit(commit_op),
39873995
&mut op_signer,
3988-
0,
39893996
)
39903997
.expect("Build leader block commit should work");
39913998

@@ -4023,13 +4030,12 @@ mod tests {
40234030
btc_controller.bootstrap_chain(101); // now, one utxo exists
40244031

40254032
let leader_key_op = utils::create_templated_leader_key_op();
4026-
4033+
40274034
let tx_id = btc_controller
40284035
.submit_operation(
40294036
StacksEpochId::Epoch31,
40304037
BlockstackOperationType::LeaderKeyRegister(leader_key_op),
40314038
&mut op_signer,
4032-
0
40334039
)
40344040
.expect("Build leader block commit should work");
40354041

testnet/stacks-node/src/burnchains/mocknet_controller.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ impl BurnchainController for MocknetController {
167167
_epoch_id: StacksEpochId,
168168
operation: BlockstackOperationType,
169169
_op_signer: &mut BurnchainOpSigner,
170-
_attempt: u64,
171170
) -> Result<Txid, BurnchainControllerError> {
172171
let txid = operation.txid();
173172
self.queued_operations.push_back(operation);

testnet/stacks-node/src/burnchains/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ pub trait BurnchainController {
6060
epoch_id: StacksEpochId,
6161
operation: BlockstackOperationType,
6262
op_signer: &mut BurnchainOpSigner,
63-
attempt: u64,
6463
) -> Result<Txid, Error>;
6564
fn sync(&mut self, target_block_height_opt: Option<u64>) -> Result<(BurnchainTip, u64), Error>;
6665
fn sortdb_ref(&self) -> &SortitionDB;

testnet/stacks-node/src/nakamoto_node/relayer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ impl RelayerThread {
961961
let mut op_signer = self.keychain.generate_op_signer();
962962
if let Ok(txid) = self
963963
.bitcoin_controller
964-
.submit_operation(cur_epoch, op, &mut op_signer, 1)
964+
.submit_operation(cur_epoch, op, &mut op_signer)
965965
{
966966
// advance key registration state
967967
self.last_vrf_key_burn_height = Some(burn_block.block_height);
@@ -1664,7 +1664,6 @@ impl RelayerThread {
16641664
*last_committed.get_epoch_id(),
16651665
BlockstackOperationType::LeaderBlockCommit(last_committed.get_block_commit().clone()),
16661666
&mut op_signer,
1667-
1,
16681667
);
16691668
let txid = match res {
16701669
Ok(txid) => txid,

testnet/stacks-node/src/neon_node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2745,7 +2745,7 @@ impl BlockMinerThread {
27452745
..
27462746
} = self.config.get_node_config(false);
27472747

2748-
let res = bitcoin_controller.submit_operation(target_epoch_id, op, &mut op_signer, attempt);
2748+
let res = bitcoin_controller.submit_operation(target_epoch_id, op, &mut op_signer);
27492749
match res {
27502750
Ok(_) => {
27512751
self.failed_to_submit_last_attempt = false;
@@ -3613,7 +3613,7 @@ impl RelayerThread {
36133613
let mut one_off_signer = self.keychain.generate_op_signer();
36143614
if let Ok(txid) =
36153615
self.bitcoin_controller
3616-
.submit_operation(cur_epoch, op, &mut one_off_signer, 1)
3616+
.submit_operation(cur_epoch, op, &mut one_off_signer)
36173617
{
36183618
// advance key registration state
36193619
self.last_vrf_key_burn_height = burn_block.block_height;

testnet/stacks-node/src/node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ impl Node {
560560
let key_reg_op = self.generate_leader_key_register_op(vrf_pk, &consensus_hash);
561561
let mut op_signer = self.keychain.generate_op_signer();
562562
let key_txid = burnchain_controller
563-
.submit_operation(cur_epoch.epoch_id, key_reg_op, &mut op_signer, 1)
563+
.submit_operation(cur_epoch.epoch_id, key_reg_op, &mut op_signer)
564564
.expect("FATAL: failed to submit leader key register operation");
565565

566566
self.leader_key_registers.insert(key_txid);
@@ -768,7 +768,7 @@ impl Node {
768768

769769
let mut op_signer = self.keychain.generate_op_signer();
770770
let txid = burnchain_controller
771-
.submit_operation(cur_epoch.epoch_id, op, &mut op_signer, 1)
771+
.submit_operation(cur_epoch.epoch_id, op, &mut op_signer)
772772
.expect("FATAL: failed to submit block-commit");
773773

774774
self.block_commits.insert(txid);

testnet/stacks-node/src/tests/epoch_205.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,12 +627,8 @@ fn transition_empty_blocks() {
627627
commit_outs,
628628
});
629629
let mut op_signer = keychain.generate_op_signer();
630-
let res = bitcoin_controller.submit_operation(
631-
StacksEpochId::Epoch2_05,
632-
op,
633-
&mut op_signer,
634-
1,
635-
);
630+
let res =
631+
bitcoin_controller.submit_operation(StacksEpochId::Epoch2_05, op, &mut op_signer);
636632
assert!(res.is_ok(), "Failed to submit block-commit");
637633
}
638634

testnet/stacks-node/src/tests/epoch_21.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,6 @@ fn transition_fixes_bitcoin_rigidity() {
670670
StacksEpochId::Epoch2_05,
671671
BlockstackOperationType::PreStx(pre_stx_op),
672672
&mut miner_signer,
673-
1
674673
)
675674
.is_ok(),
676675
"Pre-stx operation should submit successfully"
@@ -705,7 +704,6 @@ fn transition_fixes_bitcoin_rigidity() {
705704
StacksEpochId::Epoch2_05,
706705
BlockstackOperationType::TransferStx(transfer_stx_op),
707706
&mut spender_signer,
708-
1
709707
)
710708
.is_ok(),
711709
"Transfer operation should submit successfully"
@@ -826,7 +824,6 @@ fn transition_fixes_bitcoin_rigidity() {
826824
StacksEpochId::Epoch21,
827825
BlockstackOperationType::PreStx(pre_stx_op),
828826
&mut miner_signer,
829-
1
830827
)
831828
.is_ok(),
832829
"Pre-stx operation should submit successfully"
@@ -857,7 +854,6 @@ fn transition_fixes_bitcoin_rigidity() {
857854
StacksEpochId::Epoch2_05,
858855
BlockstackOperationType::TransferStx(transfer_stx_op),
859856
&mut spender_signer,
860-
1
861857
)
862858
.is_ok(),
863859
"Transfer operation should submit successfully"
@@ -1899,7 +1895,7 @@ fn transition_empty_blocks() {
18991895
});
19001896
let mut op_signer = keychain.generate_op_signer();
19011897
let res =
1902-
bitcoin_controller.submit_operation(StacksEpochId::Epoch21, op, &mut op_signer, 1);
1898+
bitcoin_controller.submit_operation(StacksEpochId::Epoch21, op, &mut op_signer);
19031899
assert!(res.is_ok(), "Failed to submit block-commit");
19041900
}
19051901

testnet/stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3489,7 +3489,6 @@ fn vote_for_aggregate_key_burn_op() {
34893489
StacksEpochId::Epoch30,
34903490
BlockstackOperationType::PreStx(pre_stx_op),
34913491
&mut miner_signer,
3492-
1
34933492
)
34943493
.is_ok(),
34953494
"Pre-stx operation should submit successfully"
@@ -3559,7 +3558,6 @@ fn vote_for_aggregate_key_burn_op() {
35593558
StacksEpochId::Epoch30,
35603559
vote_for_aggregate_key_op,
35613560
&mut signer_burnop_signer,
3562-
1
35633561
)
35643562
.is_ok(),
35653563
"Vote for aggregate key operation should submit successfully"
@@ -4593,7 +4591,6 @@ fn burn_ops_integration_test() {
45934591
StacksEpochId::Epoch30,
45944592
BlockstackOperationType::PreStx(pre_stx_op),
45954593
&mut miner_signer_1,
4596-
1
45974594
)
45984595
.is_ok(),
45994596
"Pre-stx operation should submit successfully"
@@ -4617,7 +4614,6 @@ fn burn_ops_integration_test() {
46174614
StacksEpochId::Epoch30,
46184615
BlockstackOperationType::PreStx(pre_stx_op_2),
46194616
&mut miner_signer_2,
4620-
1
46214617
)
46224618
.is_ok(),
46234619
"Pre-stx operation should submit successfully"
@@ -4638,7 +4634,6 @@ fn burn_ops_integration_test() {
46384634
StacksEpochId::Epoch30,
46394635
BlockstackOperationType::PreStx(pre_stx_op_3),
46404636
&mut miner_signer_3,
4641-
1
46424637
)
46434638
.is_ok(),
46444639
"Pre-stx operation should submit successfully"
@@ -4659,7 +4654,6 @@ fn burn_ops_integration_test() {
46594654
StacksEpochId::Epoch30,
46604655
BlockstackOperationType::PreStx(pre_stx_op_4),
46614656
&mut miner_signer_4,
4662-
1
46634657
)
46644658
.is_ok(),
46654659
"Pre-stx operation should submit successfully"
@@ -4790,7 +4784,6 @@ fn burn_ops_integration_test() {
47904784
StacksEpochId::Epoch30,
47914785
BlockstackOperationType::TransferStx(transfer_stx_op),
47924786
&mut stacker_burnop_signer_1,
4793-
1
47944787
)
47954788
.is_ok(),
47964789
"Transfer STX operation should submit successfully"
@@ -4816,7 +4809,6 @@ fn burn_ops_integration_test() {
48164809
StacksEpochId::Epoch30,
48174810
BlockstackOperationType::DelegateStx(del_stx_op),
48184811
&mut stacker_burnop_signer_2,
4819-
1
48204812
)
48214813
.is_ok(),
48224814
"Delegate STX operation should submit successfully"
@@ -4846,7 +4838,6 @@ fn burn_ops_integration_test() {
48464838
StacksEpochId::Epoch30,
48474839
BlockstackOperationType::StackStx(stack_stx_op_with_some_signer_key),
48484840
&mut signer_burnop_signer_1,
4849-
1
48504841
)
48514842
.is_ok(),
48524843
"Stack STX operation should submit successfully"
@@ -4873,7 +4864,6 @@ fn burn_ops_integration_test() {
48734864
StacksEpochId::Epoch30,
48744865
BlockstackOperationType::StackStx(stack_stx_op_with_no_signer_key),
48754866
&mut signer_burnop_signer_2,
4876-
1
48774867
)
48784868
.is_ok(),
48794869
"Stack STX operation should submit successfully"

0 commit comments

Comments
 (0)