Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out phantom txs from test_observer::parse_transaction fn #5635

Merged
merged 4 commits into from
Jan 3, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions testnet/stacks-node/src/tests/neon_integrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,13 @@ pub mod test_observer {
use std::sync::Mutex;
use std::thread;

use clarity::boot_util::boot_code_addr;
use stacks::chainstate::stacks::boot::RewardSet;
use stacks::chainstate::stacks::events::StackerDBChunksEvent;
use stacks::chainstate::stacks::StacksTransaction;
use stacks::chainstate::stacks::{StacksTransaction, TransactionPayload};
use stacks::codec::StacksMessageCodec;
use stacks::config::{EventKeyType, EventObserverConfig};
use stacks::core::CHAIN_ID_MAINNET;
use stacks::net::api::postblock_proposal::BlockValidateResponse;
use stacks::util::hash::hex_bytes;
use stacks_common::types::chainstate::StacksBlockId;
Expand Down Expand Up @@ -578,7 +580,7 @@ pub mod test_observer {
PROPOSAL_RESPONSES.lock().unwrap().clear();
}

/// Parse the StacksTransactions from a block (does not include burn ops)
/// Parse the StacksTransactions from a block (does not include burn ops or phantom txs)
/// panics on any failures to parse
pub fn parse_transactions(block: &serde_json::Value) -> Vec<StacksTransaction> {
block
Expand All @@ -597,6 +599,13 @@ pub mod test_observer {
let tx_bytes = hex_bytes(&tx_hex[2..]).unwrap();
let tx =
StacksTransaction::consensus_deserialize(&mut tx_bytes.as_slice()).unwrap();

let boot_address = boot_code_addr(tx.chain_id == CHAIN_ID_MAINNET).into();
if let TransactionPayload::TokenTransfer(address, amount, _) = &tx.payload {
jferrant marked this conversation as resolved.
Show resolved Hide resolved
if *address == boot_address && *amount == 0 {
return None;
}
}
Some(tx)
})
.collect()
Expand Down
Loading