Skip to content

Commit eef0b96

Browse files
authored
Merge pull request #292 from bane-labs/fix-request-tx
Improve `RequestTx` dBFT callback implementation
2 parents 5c8a7e2 + 4a8e38b commit eef0b96

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

consensus/dbft/dbft.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,7 @@ func New(config *params.DBFTConfig, _ ethdb.Database) (*DBFT, error) {
402402
}
403403

404404
var sorted = make([]common.Hash, len(hashes))
405-
for i := range hashes {
406-
sorted[i] = hashes[i]
407-
}
405+
copy(sorted, hashes)
408406
sort.Slice(sorted, func(i, j int) bool {
409407
return sorted[i].Cmp(sorted[j]) < 0
410408
})

eth/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ func (h *handler) BroadcastRequestTxs(txHashes []common.Hash) {
768768
}
769769
// Broadcast RequestTxs
770770
for _, peer := range peers {
771-
err := peer.RequestTxs(txHashes)
771+
err := peer.RequestTxs(txHashes[start:stop])
772772
if err != nil {
773773
log.Error("BroadcastRequestTxs", "txHashes", txHashes,
774774
"peer", peer.ID(),

0 commit comments

Comments
 (0)