@@ -591,13 +591,6 @@ impl BankRc {
591
591
}
592
592
}
593
593
594
- #[derive(Default, Debug, AbiExample)]
595
- pub struct StatusCacheRc {
596
- /// where all the Accounts are stored
597
- /// A cache of signature statuses
598
- pub status_cache: Arc<RwLock<BankStatusCache>>,
599
- }
600
-
601
594
pub type TransactionCheckResult = (Result<()>, Option<NoncePartial>);
602
595
603
596
pub struct TransactionResults {
@@ -1020,7 +1013,7 @@ impl PartialEq for Bank {
1020
1013
}
1021
1014
let Self {
1022
1015
rc: _,
1023
- src : _,
1016
+ status_cache : _,
1024
1017
blockhash_queue,
1025
1018
ancestors,
1026
1019
hash,
@@ -1190,7 +1183,8 @@ pub struct Bank {
1190
1183
/// References to accounts, parent and signature status
1191
1184
pub rc: BankRc,
1192
1185
1193
- pub src: StatusCacheRc,
1186
+ /// A cache of signature statuses
1187
+ pub status_cache: Arc<RwLock<BankStatusCache>>,
1194
1188
1195
1189
/// FIFO queue of `recent_blockhash` items
1196
1190
blockhash_queue: RwLock<BlockhashQueue>,
@@ -1489,7 +1483,7 @@ impl Bank {
1489
1483
let mut bank = Self {
1490
1484
rewrites_skipped_this_slot: Rewrites::default(),
1491
1485
rc: BankRc::new(accounts, Slot::default()),
1492
- src: StatusCacheRc ::default(),
1486
+ status_cache: Arc::<RwLock<BankStatusCache>> ::default(),
1493
1487
blockhash_queue: RwLock::<BlockhashQueue>::default(),
1494
1488
ancestors: Ancestors::default(),
1495
1489
hash: RwLock::<Hash>::default(),
@@ -1724,12 +1718,8 @@ impl Bank {
1724
1718
"bank_rc_creation",
1725
1719
);
1726
1720
1727
- let (src, status_cache_rc_time) = measure!(
1728
- StatusCacheRc {
1729
- status_cache: parent.src.status_cache.clone(),
1730
- },
1731
- "status_cache_rc_creation",
1732
- );
1721
+ let (status_cache, status_cache_time) =
1722
+ measure!(Arc::clone(&parent.status_cache), "status_cache_creation",);
1733
1723
1734
1724
let ((fee_rate_governor, fee_calculator), fee_components_time) = measure!(
1735
1725
{
@@ -1799,7 +1789,7 @@ impl Bank {
1799
1789
let mut new = Bank {
1800
1790
rewrites_skipped_this_slot: Rewrites::default(),
1801
1791
rc,
1802
- src ,
1792
+ status_cache ,
1803
1793
slot,
1804
1794
bank_id,
1805
1795
epoch,
@@ -2027,7 +2017,7 @@ impl Bank {
2027
2017
("parent_slot", parent.slot(), i64),
2028
2018
("bank_rc_creation_us", bank_rc_time.as_us(), i64),
2029
2019
("total_elapsed_us", time.as_us(), i64),
2030
- ("status_cache_rc_us ", status_cache_rc_time .as_us(), i64),
2020
+ ("status_cache_us ", status_cache_time .as_us(), i64),
2031
2021
("fee_components_us", fee_components_time.as_us(), i64),
2032
2022
("blockhash_queue_us", blockhash_queue_time.as_us(), i64),
2033
2023
("stakes_cache_us", stakes_cache_time.as_us(), i64),
@@ -2155,7 +2145,7 @@ impl Bank {
2155
2145
let mut bank = Self {
2156
2146
rewrites_skipped_this_slot: Rewrites::default(),
2157
2147
rc: bank_rc,
2158
- src : new(),
2148
+ status_cache : new(),
2159
2149
blockhash_queue: RwLock::new(fields.blockhash_queue),
2160
2150
ancestors,
2161
2151
hash: RwLock::new(fields.hash),
@@ -2356,7 +2346,7 @@ impl Bank {
2356
2346
}
2357
2347
2358
2348
pub fn status_cache_ancestors(&self) -> Vec<u64> {
2359
- let mut roots = self.src. status_cache.read().unwrap().roots().clone();
2349
+ let mut roots = self.status_cache.read().unwrap().roots().clone();
2360
2350
let min = roots.iter().min().cloned().unwrap_or(0);
2361
2351
for ancestor in self.ancestors.keys() {
2362
2352
if ancestor >= min {
@@ -3450,7 +3440,7 @@ impl Bank {
3450
3440
let mut squash_cache_time = Measure::start("squash_cache_time");
3451
3441
roots
3452
3442
.iter()
3453
- .for_each(|slot| self.src. status_cache.write().unwrap().add_root(*slot));
3443
+ .for_each(|slot| self.status_cache.write().unwrap().add_root(*slot));
3454
3444
squash_cache_time.stop();
3455
3445
3456
3446
SquashTiming {
@@ -3757,23 +3747,19 @@ impl Bank {
3757
3747
3758
3748
/// Forget all signatures. Useful for benchmarking.
3759
3749
pub fn clear_signatures(&self) {
3760
- self.src. status_cache.write().unwrap().clear();
3750
+ self.status_cache.write().unwrap().clear();
3761
3751
}
3762
3752
3763
3753
pub fn clear_slot_signatures(&self, slot: Slot) {
3764
- self.src
3765
- .status_cache
3766
- .write()
3767
- .unwrap()
3768
- .clear_slot_entries(slot);
3754
+ self.status_cache.write().unwrap().clear_slot_entries(slot);
3769
3755
}
3770
3756
3771
3757
fn update_transaction_statuses(
3772
3758
&self,
3773
3759
sanitized_txs: &[SanitizedTransaction],
3774
3760
execution_results: &[TransactionExecutionResult],
3775
3761
) {
3776
- let mut status_cache = self.src. status_cache.write().unwrap();
3762
+ let mut status_cache = self.status_cache.write().unwrap();
3777
3763
assert_eq!(sanitized_txs.len(), execution_results.len());
3778
3764
for (tx, execution_result) in sanitized_txs.iter().zip(execution_results) {
3779
3765
if let Some(details) = execution_result.details() {
@@ -4113,7 +4099,7 @@ impl Bank {
4113
4099
lock_results: Vec<TransactionCheckResult>,
4114
4100
error_counters: &mut TransactionErrorMetrics,
4115
4101
) -> Vec<TransactionCheckResult> {
4116
- let rcache = self.src. status_cache.read().unwrap();
4102
+ let rcache = self.status_cache.read().unwrap();
4117
4103
sanitized_txs
4118
4104
.iter()
4119
4105
.zip(lock_results)
@@ -6648,14 +6634,14 @@ impl Bank {
6648
6634
signature: &Signature,
6649
6635
blockhash: &Hash,
6650
6636
) -> Option<Result<()>> {
6651
- let rcache = self.src. status_cache.read().unwrap();
6637
+ let rcache = self.status_cache.read().unwrap();
6652
6638
rcache
6653
6639
.get_status(signature, blockhash, &self.ancestors)
6654
6640
.map(|v| v.1)
6655
6641
}
6656
6642
6657
6643
pub fn get_signature_status_slot(&self, signature: &Signature) -> Option<(Slot, Result<()>)> {
6658
- let rcache = self.src. status_cache.read().unwrap();
6644
+ let rcache = self.status_cache.read().unwrap();
6659
6645
rcache.get_status_any_blockhash(signature, &self.ancestors)
6660
6646
}
6661
6647
0 commit comments