Skip to content

Commit

Permalink
fix: get_block_transactions_process should fill missing uncle in resp…
Browse files Browse the repository at this point in the history
…onse
  • Loading branch information
zhangsoledad committed Oct 10, 2019
1 parent 1633a16 commit 77a2769
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 0 additions & 2 deletions sync/src/relayer/compact_block_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ impl<'a> CompactBlockProcess<'a> {
}
}

assert!(!missing_transactions.is_empty() || !missing_uncles.is_empty());

pending_compact_blocks
.entry(block_hash.clone())
.or_insert_with(|| (compact_block, HashMap::default()))
Expand Down
8 changes: 8 additions & 0 deletions sync/src/relayer/get_block_transactions_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,17 @@ impl<'a> GetBlockTransactionsProcess<'a> {
})
.collect::<Vec<_>>();

let uncles = self
.message
.uncle_indexes()
.iter()
.filter_map(|i| block.uncles().get(Unpack::<u32>::unpack(&i) as usize))
.collect::<Vec<_>>();

let content = packed::BlockTransactions::new_builder()
.block_hash(block_hash)
.transactions(transactions.into_iter().map(|tx| tx.data()).pack())
.uncles(uncles.into_iter().map(|uncle| uncle.data()).pack())
.build();
let message = packed::RelayMessage::new_builder().set(content).build();
let data = message.as_slice().into();
Expand Down

0 comments on commit 77a2769

Please sign in to comment.