Accountsdb plugin transaction part 3: Transaction Notifier (#21374)
The TransactionNotifierInterface interface for notifying transactions. Changes to transaction_status_service to notify the notifier of the transaction data. Interface to query the plugin's interest in transaction data
This commit is contained in:
@ -12,6 +12,8 @@ documentation = "https://docs.rs/solana-validator"
|
||||
[dependencies]
|
||||
log = "0.4.11"
|
||||
thiserror = "1.0.30"
|
||||
solana-sdk = { path = "../sdk", version = "=1.9.0" }
|
||||
solana-transaction-status = { path = "../transaction-status", version = "=1.9.0" }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
@ -3,6 +3,8 @@
|
||||
/// In addition, the dynamic library must export a "C" function _create_plugin which
|
||||
/// creates the implementation of the plugin.
|
||||
use {
|
||||
solana_sdk::{signature::Signature, transaction::SanitizedTransaction},
|
||||
solana_transaction_status::TransactionStatusMeta,
|
||||
std::{any::Any, error, io},
|
||||
thiserror::Error,
|
||||
};
|
||||
@ -24,6 +26,18 @@ pub enum ReplicaAccountInfoVersions<'a> {
|
||||
V0_0_1(&'a ReplicaAccountInfo<'a>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ReplicaTransactionInfo<'a> {
|
||||
pub signature: &'a Signature,
|
||||
pub is_vote: bool,
|
||||
pub transaction: &'a SanitizedTransaction,
|
||||
pub transaction_status_meta: &'a TransactionStatusMeta,
|
||||
}
|
||||
|
||||
pub enum ReplicaTransactionInfoVersions<'a> {
|
||||
V0_0_1(&'a ReplicaTransactionInfo<'a>),
|
||||
}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum AccountsDbPluginError {
|
||||
#[error("Error opening config file. Error detail: ({0}).")]
|
||||
@ -105,10 +119,27 @@ pub trait AccountsDbPlugin: Any + Send + Sync + std::fmt::Debug {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Called when a transaction is updated at a slot.
|
||||
#[allow(unused_variables)]
|
||||
fn notify_transaction(
|
||||
&mut self,
|
||||
transaction: ReplicaTransactionInfoVersions,
|
||||
slot: u64,
|
||||
) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Check if the plugin is interested in account data
|
||||
/// Default is true -- if the plugin is not interested in
|
||||
/// account data, please return false.
|
||||
fn to_notify_account_data(&self) -> bool {
|
||||
fn account_data_notifications_enabled(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Check if the plugin is interested in transaction data
|
||||
/// Default is false -- if the plugin is not interested in
|
||||
/// transaction data, please return false.
|
||||
fn transaction_notifications_enabled(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user