kaspa_mining/model/
owner_txs.rs

1use kaspa_consensus_core::tx::{MutableTransaction, ScriptPublicKey, TransactionId};
2use std::collections::{HashMap, HashSet};
3
4use super::TransactionIdSet;
5
6pub type ScriptPublicKeySet = HashSet<ScriptPublicKey>;
7
8/// Transaction ids involved in either sending to or receiving from an
9/// address or its [`ScriptPublicKey`] equivalent.
10#[derive(Default)]
11pub struct OwnerTransactions {
12    pub sending_txs: TransactionIdSet,
13    pub receiving_txs: TransactionIdSet,
14}
15
16impl OwnerTransactions {
17    pub fn is_empty(&self) -> bool {
18        self.sending_txs.is_empty() && self.receiving_txs.is_empty()
19    }
20}
21
22/// Transactions grouped by owning addresses
23#[derive(Default)]
24pub struct GroupedOwnerTransactions {
25    pub transactions: HashMap<TransactionId, MutableTransaction>,
26    pub owners: HashMap<ScriptPublicKey, OwnerTransactions>,
27}