committed by
GitHub
parent
bfcfbab818
commit
4ca352a344
@ -14,9 +14,6 @@ use crate::{
|
|||||||
message_processor::{MessageProcessor, ProcessInstruction},
|
message_processor::{MessageProcessor, ProcessInstruction},
|
||||||
nonce_utils,
|
nonce_utils,
|
||||||
rent_collector::RentCollector,
|
rent_collector::RentCollector,
|
||||||
serde_utils::{
|
|
||||||
deserialize_atomicbool, deserialize_atomicu64, serialize_atomicbool, serialize_atomicu64,
|
|
||||||
},
|
|
||||||
stakes::Stakes,
|
stakes::Stakes,
|
||||||
status_cache::{SlotDelta, StatusCache},
|
status_cache::{SlotDelta, StatusCache},
|
||||||
system_instruction_processor::{self, get_system_account_kind, SystemAccountKind},
|
system_instruction_processor::{self, get_system_account_kind, SystemAccountKind},
|
||||||
@ -271,23 +268,15 @@ pub struct Bank {
|
|||||||
hard_forks: Arc<RwLock<HardForks>>,
|
hard_forks: Arc<RwLock<HardForks>>,
|
||||||
|
|
||||||
/// The number of transactions processed without error
|
/// The number of transactions processed without error
|
||||||
#[serde(serialize_with = "serialize_atomicu64")]
|
|
||||||
#[serde(deserialize_with = "deserialize_atomicu64")]
|
|
||||||
transaction_count: AtomicU64,
|
transaction_count: AtomicU64,
|
||||||
|
|
||||||
/// Bank tick height
|
/// Bank tick height
|
||||||
#[serde(serialize_with = "serialize_atomicu64")]
|
|
||||||
#[serde(deserialize_with = "deserialize_atomicu64")]
|
|
||||||
tick_height: AtomicU64,
|
tick_height: AtomicU64,
|
||||||
|
|
||||||
/// The number of signatures from valid transactions in this slot
|
/// The number of signatures from valid transactions in this slot
|
||||||
#[serde(serialize_with = "serialize_atomicu64")]
|
|
||||||
#[serde(deserialize_with = "deserialize_atomicu64")]
|
|
||||||
signature_count: AtomicU64,
|
signature_count: AtomicU64,
|
||||||
|
|
||||||
/// Total capitalization, used to calculate inflation
|
/// Total capitalization, used to calculate inflation
|
||||||
#[serde(serialize_with = "serialize_atomicu64")]
|
|
||||||
#[serde(deserialize_with = "deserialize_atomicu64")]
|
|
||||||
capitalization: AtomicU64,
|
capitalization: AtomicU64,
|
||||||
|
|
||||||
// Bank max_tick_height
|
// Bank max_tick_height
|
||||||
@ -324,8 +313,6 @@ pub struct Bank {
|
|||||||
collector_id: Pubkey,
|
collector_id: Pubkey,
|
||||||
|
|
||||||
/// Fees that have been collected
|
/// Fees that have been collected
|
||||||
#[serde(serialize_with = "serialize_atomicu64")]
|
|
||||||
#[serde(deserialize_with = "deserialize_atomicu64")]
|
|
||||||
collector_fees: AtomicU64,
|
collector_fees: AtomicU64,
|
||||||
|
|
||||||
/// Latest transaction fees for transactions processed by this bank
|
/// Latest transaction fees for transactions processed by this bank
|
||||||
@ -335,8 +322,6 @@ pub struct Bank {
|
|||||||
fee_rate_governor: FeeRateGovernor,
|
fee_rate_governor: FeeRateGovernor,
|
||||||
|
|
||||||
/// Rent that have been collected
|
/// Rent that have been collected
|
||||||
#[serde(serialize_with = "serialize_atomicu64")]
|
|
||||||
#[serde(deserialize_with = "deserialize_atomicu64")]
|
|
||||||
collected_rent: AtomicU64,
|
collected_rent: AtomicU64,
|
||||||
|
|
||||||
/// latest rent collector, knows the epoch
|
/// latest rent collector, knows the epoch
|
||||||
@ -360,8 +345,6 @@ pub struct Bank {
|
|||||||
|
|
||||||
/// A boolean reflecting whether any entries were recorded into the PoH
|
/// A boolean reflecting whether any entries were recorded into the PoH
|
||||||
/// stream for the slot == self.slot
|
/// stream for the slot == self.slot
|
||||||
#[serde(serialize_with = "serialize_atomicbool")]
|
|
||||||
#[serde(deserialize_with = "deserialize_atomicbool")]
|
|
||||||
is_delta: AtomicBool,
|
is_delta: AtomicBool,
|
||||||
|
|
||||||
/// The Message processor
|
/// The Message processor
|
||||||
|
@ -13,7 +13,6 @@ pub mod message_processor;
|
|||||||
mod native_loader;
|
mod native_loader;
|
||||||
pub mod nonce_utils;
|
pub mod nonce_utils;
|
||||||
pub mod rent_collector;
|
pub mod rent_collector;
|
||||||
mod serde_utils;
|
|
||||||
pub mod stakes;
|
pub mod stakes;
|
||||||
pub mod status_cache;
|
pub mod status_cache;
|
||||||
mod system_instruction_processor;
|
mod system_instruction_processor;
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
use std::{
|
|
||||||
fmt,
|
|
||||||
sync::atomic::{AtomicBool, AtomicU64, Ordering},
|
|
||||||
};
|
|
||||||
|
|
||||||
struct U64Visitor;
|
|
||||||
impl<'a> serde::de::Visitor<'a> for U64Visitor {
|
|
||||||
type Value = u64;
|
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
formatter.write_str("Expecting u64")
|
|
||||||
}
|
|
||||||
fn visit_u64<E>(self, data: u64) -> std::result::Result<u64, E>
|
|
||||||
where
|
|
||||||
E: serde::de::Error,
|
|
||||||
{
|
|
||||||
Ok(data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn deserialize_atomicu64<'de, D>(d: D) -> Result<AtomicU64, D::Error>
|
|
||||||
where
|
|
||||||
D: serde::de::Deserializer<'de>,
|
|
||||||
{
|
|
||||||
let value = d.deserialize_u64(U64Visitor)?;
|
|
||||||
Ok(AtomicU64::new(value))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn serialize_atomicu64<S>(x: &AtomicU64, s: S) -> Result<S::Ok, S::Error>
|
|
||||||
where
|
|
||||||
S: serde::Serializer,
|
|
||||||
{
|
|
||||||
s.serialize_u64(x.load(Ordering::Relaxed))
|
|
||||||
}
|
|
||||||
|
|
||||||
struct BoolVisitor;
|
|
||||||
impl<'a> serde::de::Visitor<'a> for BoolVisitor {
|
|
||||||
type Value = bool;
|
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
formatter.write_str("Expecting bool")
|
|
||||||
}
|
|
||||||
fn visit_bool<E>(self, data: bool) -> std::result::Result<bool, E>
|
|
||||||
where
|
|
||||||
E: serde::de::Error,
|
|
||||||
{
|
|
||||||
Ok(data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn deserialize_atomicbool<'de, D>(d: D) -> Result<AtomicBool, D::Error>
|
|
||||||
where
|
|
||||||
D: serde::de::Deserializer<'de>,
|
|
||||||
{
|
|
||||||
let value = d.deserialize_bool(BoolVisitor)?;
|
|
||||||
Ok(AtomicBool::new(value))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn serialize_atomicbool<S>(x: &AtomicBool, s: S) -> Result<S::Ok, S::Error>
|
|
||||||
where
|
|
||||||
S: serde::Serializer,
|
|
||||||
{
|
|
||||||
s.serialize_bool(x.load(Ordering::Relaxed))
|
|
||||||
}
|
|
Reference in New Issue
Block a user