Fix broadcast for typed tx

This commit is contained in:
rakita 2021-04-15 20:33:41 +02:00
parent a716eb3871
commit 459a1a02a4
2 changed files with 4 additions and 4 deletions

Binary file not shown.

View File

@ -238,15 +238,15 @@ impl SyncPropagator {
for tx in &transactions { for tx in &transactions {
let hash = tx.hash(); let hash = tx.hash();
if to_send.contains(&hash) { if to_send.contains(&hash) {
let appended = tx.rlp_append(&mut packet);
packet.append_raw_checked(&tx.encode(), 1, MAX_TRANSACTION_PACKET_SIZE); pushed += 1;
if !appended { // this is not hard limit and we are okay with it. Max default tx size is 300k.
if packet.as_raw().len() >= MAX_TRANSACTION_PACKET_SIZE {
// Maximal packet size reached just proceed with sending // Maximal packet size reached just proceed with sending
debug!(target: "sync", "Transaction packet size limit reached. Sending incomplete set of {}/{} transactions.", pushed, to_send.len()); debug!(target: "sync", "Transaction packet size limit reached. Sending incomplete set of {}/{} transactions.", pushed, to_send.len());
to_send = to_send.into_iter().take(pushed).collect(); to_send = to_send.into_iter().take(pushed).collect();
break; break;
} }
pushed += 1;
} }
} }
packet.complete_unbounded_list(); packet.complete_unbounded_list();