@@ -34,6 +34,7 @@ use madhouse::{execute_commands, prop_allof, scenario, Command, CommandWrapper};
3434use pinny::tag;
3535use proptest::prelude::Strategy;
3636use rand::{thread_rng, Rng};
37+ use reqwest::header::AUTHORIZATION;
3738use rusqlite::Connection;
3839use stacks::address::AddressHashMode;
3940use stacks::burnchains::Txid;
@@ -67,6 +68,7 @@ use stacks::core::test_util::{
6768use stacks::core::{StacksEpochId, CHAIN_ID_TESTNET, HELIUM_BLOCK_LIMIT_20};
6869use stacks::libstackerdb::StackerDBChunkData;
6970use stacks::net::api::getsigner::GetSignerResponse;
71+ use stacks::net::api::gettransaction::TransactionResponse;
7072use stacks::net::api::postblock_proposal::{
7173 BlockValidateResponse, ValidateRejectCode, TEST_REJECT_REPLAY_TXS,
7274 TEST_VALIDATE_DELAY_DURATION_SECS, TEST_VALIDATE_STALL,
@@ -3989,6 +3991,7 @@ fn tx_replay_btc_on_stx_invalidation() {
39893991 c.reset_replay_set_after_fork_blocks = 5;
39903992 },
39913993 |node_config| {
3994+ node_config.node.txindex = true;
39923995 node_config.miner.block_commit_delay = Duration::from_secs(1);
39933996 node_config.miner.replay_transactions = true;
39943997 node_config.miner.activated_vrf_key_path =
@@ -4001,7 +4004,7 @@ fn tx_replay_btc_on_stx_invalidation() {
40014004
40024005 let conf = &signer_test.running_nodes.conf;
40034006 let mut miner_keychain = Keychain::default(conf.node.seed.clone()).generate_op_signer();
4004- let _http_origin = format!("http://{}", &conf.node.rpc_bind);
4007+ let http_origin = format!("http://{}", &conf.node.rpc_bind);
40054008 let mut btc_controller = BitcoinRegtestController::new(conf.clone(), None);
40064009 let submitted_commits = signer_test
40074010 .running_nodes
@@ -4081,7 +4084,7 @@ fn tx_replay_btc_on_stx_invalidation() {
40814084 signer_test.mine_nakamoto_block(Duration::from_secs(30), true);
40824085
40834086 wait_for(30, || {
4084- let account = get_account(&_http_origin , &recipient_addr);
4087+ let account = get_account(&http_origin , &recipient_addr);
40854088 Ok(account.balance == recipient_balance.into())
40864089 })
40874090 .expect("Timed out waiting for balance to be updated");
@@ -4178,9 +4181,35 @@ fn tx_replay_btc_on_stx_invalidation() {
41784181
41794182 assert!(found_block, "Failed to mine the tenure change block");
41804183 // Ensure that in the 30 seconds, the nonce did not increase. This also asserts that no tx replays were mined.
4181- let account = get_account(&_http_origin , &recipient_addr);
4184+ let account = get_account(&http_origin , &recipient_addr);
41824185 assert_eq!(account.nonce, 0, "Expected recipient nonce to be 0");
41834186
4187+ // Call `/v3/transaction/{txid}` and verify that `is_canonical` is false
4188+ let get_transaction = |txid: &String| {
4189+ let url = &format!("{http_origin}/v3/transaction/{txid}");
4190+ info!("Send request: GET {url}");
4191+ reqwest::blocking::Client::new()
4192+ .get(url)
4193+ .header(
4194+ AUTHORIZATION,
4195+ conf.connection_options.auth_token.clone().unwrap(),
4196+ )
4197+ .send()
4198+ .unwrap_or_else(|e| panic!("GET request failed: {e}"))
4199+ .json::<TransactionResponse>()
4200+ .unwrap()
4201+ };
4202+
4203+ let transaction = get_transaction(&txid);
4204+ assert!(
4205+ !transaction.is_canonical,
4206+ "Expected transaction response to be non-canonical"
4207+ );
4208+ assert!(
4209+ transaction.block_height.is_none(),
4210+ "Expected block height of tx response to be none"
4211+ );
4212+
41844213 signer_test.shutdown();
41854214}
41864215
0 commit comments