removes redundant clone in gossip PruneData::signable_data (#26510)
PruneData::signable_data redundantly clones inner fields, while only references suffice: https://github.com/solana-labs/solana/blob/d1370f2c7/gossip/src/cluster_info.rs#L219-L233
This commit is contained in:
parent
9547b00f4c
commit
df616a0dda
|
@ -218,16 +218,16 @@ impl Signable for PruneData {
|
|||
|
||||
fn signable_data(&self) -> Cow<[u8]> {
|
||||
#[derive(Serialize)]
|
||||
struct SignData {
|
||||
pubkey: Pubkey,
|
||||
prunes: Vec<Pubkey>,
|
||||
destination: Pubkey,
|
||||
struct SignData<'a> {
|
||||
pubkey: &'a Pubkey,
|
||||
prunes: &'a [Pubkey],
|
||||
destination: &'a Pubkey,
|
||||
wallclock: u64,
|
||||
}
|
||||
let data = SignData {
|
||||
pubkey: self.pubkey,
|
||||
prunes: self.prunes.clone(),
|
||||
destination: self.destination,
|
||||
pubkey: &self.pubkey,
|
||||
prunes: &self.prunes,
|
||||
destination: &self.destination,
|
||||
wallclock: self.wallclock,
|
||||
};
|
||||
Cow::Owned(serialize(&data).expect("serialize PruneData"))
|
||||
|
|
Loading…
Reference in New Issue