removes id from push_lowest_slot args (#18645)
push_lowest_slot cannot sign the new crds-value unless the id (pubkey) argument passed-in is the same pubkey as in ClusterInfo::keypair(), in which case the id argument is redundant: https://github.com/solana-labs/solana/blob/bb41cf346/gossip/src/cluster_info.rs#L824-L845 Additionally, the lookup is done with self.id(), but insert is done with the id argument, which is logically a bug.
This commit is contained in:
@ -821,20 +821,20 @@ impl ClusterInfo {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn push_lowest_slot(&self, id: Pubkey, min: Slot) {
|
||||
let now = timestamp();
|
||||
let last = self
|
||||
.gossip
|
||||
.read()
|
||||
.unwrap()
|
||||
.crds
|
||||
.get(&CrdsValueLabel::LowestSlot(self.id()))
|
||||
.and_then(|x| x.value.lowest_slot())
|
||||
.map(|x| x.lowest)
|
||||
.unwrap_or(0);
|
||||
pub fn push_lowest_slot(&self, min: Slot) {
|
||||
let self_pubkey = self.id();
|
||||
let last = {
|
||||
let gossip = self.gossip.read().unwrap();
|
||||
gossip
|
||||
.crds
|
||||
.get_lowest_slot(self_pubkey)
|
||||
.map(|x| x.lowest)
|
||||
.unwrap_or_default()
|
||||
};
|
||||
if min > last {
|
||||
let now = timestamp();
|
||||
let entry = CrdsValue::new_signed(
|
||||
CrdsData::LowestSlot(0, LowestSlot::new(id, min, now)),
|
||||
CrdsData::LowestSlot(0, LowestSlot::new(self_pubkey, min, now)),
|
||||
&self.keypair(),
|
||||
);
|
||||
self.local_message_pending_push_queue
|
||||
|
@ -83,7 +83,7 @@ impl Signable for CrdsValue {
|
||||
pub enum CrdsData {
|
||||
ContactInfo(ContactInfo),
|
||||
Vote(VoteIndex, Vote),
|
||||
LowestSlot(u8, LowestSlot),
|
||||
LowestSlot(/*DEPRECATED:*/ u8, LowestSlot),
|
||||
SnapshotHashes(SnapshotHash),
|
||||
AccountsHashes(SnapshotHash),
|
||||
EpochSlots(EpochSlotsIndex, EpochSlots),
|
||||
|
Reference in New Issue
Block a user