miden-ntx-builder 0.16.1

Miden network transaction builder
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Returns the network accounts that currently have pending notes.

use miden_node_db::DatabaseError;
use miden_node_db::sqlite::ReadTx;
use miden_protocol::account::AccountId;

const SQL: &str = include_str!("accounts_with_pending_notes.sql");

/// Returns the distinct set of network accounts that currently have at least one pending note
/// (unconsumed and within the per-note attempt budget).
#[expect(clippy::cast_possible_wrap)]
pub fn accounts_with_pending_notes(
    tx: &ReadTx<'_>,
    max_attempts: usize,
) -> Result<Vec<AccountId>, DatabaseError> {
    tx.query(SQL, &[&(max_attempts as i64)], |row| row.get::<AccountId>(0))
}