Skip to content

[PoC] feat: address transactions filtering - #162

Draft
rodribp wants to merge 1 commit into
mempoolfrom
rodribp/filtered-txs-endpoints
Draft

rodribp wants to merge 1 commit into
mempoolfrom
rodribp/filtered-txs-endpoints

Conversation

@rodribp

@rodribp rodribp commented Sep 21, 2026

Copy link
Copy Markdown
Member

Vibe coded 🎧 support of filtered tx responses in /address/<addr>/txs

For the purpose of #6697 to make #6775 work

Filters available:

  1. Direction ( incoming | outgoing )
  2. Min / max amount.
  3. From / to ( block height | timestamp )

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Client-controlled limits bypass the scan ceiling, and collation uses quadratic duplicate tracking.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Adds filtered address and scripthash transaction history by direction, amount, height, and timestamp.

Changes:

  • Parses and validates transaction filters.
  • Filters mempool and confirmed histories with pagination metadata.
  • Adds a configurable confirmed-history scan limit.
File Description
src/​util/​tx_filter.rs Defines filter parsing, validation, and matching.
src/​util/​mod.rs Exports filter types.
src/​rest.rs Integrates filters and truncation headers.
src/​new_index/​schema.rs Implements confirmed-history filtering and collation.
src/​new_index/​mod.rs Exports scan outcomes.
src/​new_index/​mempool.rs Implements mempool filtering.
src/​config.rs Adds the scan-limit option.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/rest.rs
})
.collect::<Result<Vec<_>, _>>()?;
&filter,
cmp::max(config.rest_max_address_txs_filter_scan, max_txs),
Comment thread src/new_index/schema.rs
Comment on lines +2180 to +2202
let mut txs: Vec<(SlotTx, Vec<(u32, bool)>)> = Vec::new();
for row in rows {
let txid = row.get_txid();
let entry = (row.key.txinfo.get_vin_or_vout(), row.key.txinfo.has_vin());
let delta = row.key.txinfo.net_delta();
match txs.iter_mut().find(|(tx, _)| tx.txid == txid) {
Some((tx, entries)) => {
if !entries.contains(&entry) {
entries.push(entry);
tx.value = tx.value.saturating_add(delta);
}
}
None => txs.push((
SlotTx {
txid,
row_height: row.key.confirmed_height,
tx_position: row.key.tx_position,
value: delta,
},
vec![entry],
)),
}
}
@rodribp rodribp changed the title feat: address transactions filtering [PoC] feat: address transactions filtering Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants