-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Misc docs and renames …and one less clone #11556
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -675,7 +675,7 @@ impl SyncHandler { | |
| } | ||
|
|
||
| /// Called when peer sends us new transactions | ||
| pub fn on_peer_transactions(sync: &ChainSync, io: &mut dyn SyncIo, peer_id: PeerId, r: &Rlp) -> Result<(), PacketDecodeError> { | ||
| pub fn on_peer_transactions(sync: &ChainSync, io: &mut dyn SyncIo, peer_id: PeerId, tx_rlp: Rlp) -> Result<(), PacketDecodeError> { | ||
| // Accept transactions only when fully synced | ||
| if !io.is_chain_queue_empty() || (sync.state != SyncState::Idle && sync.state != SyncState::NewBlocks) { | ||
| trace!(target: "sync", "{} Ignoring transactions while syncing", peer_id); | ||
|
|
@@ -686,11 +686,11 @@ impl SyncHandler { | |
| return Ok(()); | ||
| } | ||
|
|
||
| let item_count = r.item_count()?; | ||
| let item_count = tx_rlp.item_count()?; | ||
| trace!(target: "sync", "{:02} -> Transactions ({} entries)", peer_id, item_count); | ||
| let mut transactions = Vec::with_capacity(item_count); | ||
| for i in 0 .. item_count { | ||
| let rlp = r.at(i)?; | ||
| let rlp = tx_rlp.at(i)?; | ||
| let tx = rlp.as_raw().to_vec(); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to get rid of this copy here, but I can't make it work.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it is possible because
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, my plan was to defer the allocation until we transform the rlp bytes into |
||
| transactions.push(tx); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.