mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-24 15:21:33 +00:00
Stack allocated PeerId (#1874)
* Stack allocate PeerId. * Update stuff. * Upgrade rusttls to fix build. * Remove unnecessary manual implementations. * Remove PeerId::into_bytes. * Remove bytes dependency. * Perform some cleanup. * Use Into<kbucket::Key<K>>. * Update versions and changelogs. * Fix PR link. * Fix benchmarks. Co-authored-by: Roman S. Borschel <roman@parity.io>
This commit is contained in:
@ -61,7 +61,7 @@ where
|
||||
let mut messages = Vec::with_capacity(rpc.publish.len());
|
||||
for publish in rpc.publish.into_iter() {
|
||||
messages.push(FloodsubMessage {
|
||||
source: PeerId::from_bytes(publish.from.unwrap_or_default()).map_err(|_| {
|
||||
source: PeerId::from_bytes(&publish.from.unwrap_or_default()).map_err(|_| {
|
||||
FloodsubDecodeError::InvalidPeerId
|
||||
})?,
|
||||
data: publish.data.unwrap_or_default(),
|
||||
@ -179,7 +179,7 @@ impl FloodsubRpc {
|
||||
publish: self.messages.into_iter()
|
||||
.map(|msg| {
|
||||
rpc_proto::Message {
|
||||
from: Some(msg.source.into_bytes()),
|
||||
from: Some(msg.source.to_bytes()),
|
||||
data: Some(msg.data),
|
||||
seqno: Some(msg.sequence_number),
|
||||
topic_ids: msg.topics
|
||||
|
Reference in New Issue
Block a user