Add more slot update notifications (#15734)

* Add more slot update notifications

* fix merge

* Address feedback and add integration test

* switch to datapoint

* remove unused shred method

* fix clippy

* new thread for rpc completed slots

* remove extra constant

* fixes

* rely on channel closing

* fix check
This commit is contained in:
Justin Starry
2021-03-12 21:44:06 +08:00
committed by GitHub
parent 28c27893b9
commit 918d04e3f0
15 changed files with 340 additions and 98 deletions

View File

@@ -2,13 +2,9 @@
use crate::sigverify;
use crate::sigverify_stage::SigVerifier;
use solana_ledger::leader_schedule_cache::LeaderScheduleCache;
use solana_ledger::shred::{OFFSET_OF_SHRED_SLOT, SIZE_OF_SHRED_SLOT};
use solana_ledger::shred::Shred;
use solana_ledger::sigverify_shreds::verify_shreds_gpu;
use solana_perf::{
self,
packet::{limited_deserialize, Packets},
recycler_cache::RecyclerCache,
};
use solana_perf::{self, packet::Packets, recycler_cache::RecyclerCache};
use solana_runtime::bank_forks::BankForks;
use std::collections::{HashMap, HashSet};
use std::sync::{Arc, RwLock};
@@ -38,18 +34,7 @@ impl ShredSigVerifier {
fn read_slots(batches: &[Packets]) -> HashSet<u64> {
batches
.iter()
.flat_map(|batch| {
batch.packets.iter().filter_map(|packet| {
let slot_start = OFFSET_OF_SHRED_SLOT;
let slot_end = slot_start + SIZE_OF_SHRED_SLOT;
trace!("slot {} {}", slot_start, slot_end,);
if slot_end <= packet.meta.size {
limited_deserialize(&packet.data[slot_start..slot_end]).ok()
} else {
None
}
})
})
.flat_map(|batch| batch.packets.iter().filter_map(Shred::get_slot_from_packet))
.collect()
}
}