Limit the size of gossip push and gossip pull response (#5348)

* Limit the size of gossip push and gossip pull response

* Remove Default::default

* Rename var
This commit is contained in:
Sagar Dhawan
2019-07-30 15:43:17 -07:00
committed by GitHub
parent a7a10e12c7
commit d7a2b790dc
2 changed files with 117 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
use crate::contact_info::ContactInfo;
use bincode::serialize;
use bincode::{serialize, serialized_size};
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, Signable, Signature};
use solana_sdk::transaction::Transaction;
@@ -189,6 +189,11 @@ impl CrdsValue {
CrdsValueLabel::EpochSlots(*key),
]
}
/// Returns the size (in bytes) of a CrdsValue
pub fn size(&self) -> u64 {
serialized_size(&self).expect("unable to serialize contact info")
}
}
impl Signable for CrdsValue {