Skip to content

Commit 270fbfb

Browse files
committed
eth: fix transaction announce/broadcast goroutine leak
1 parent 92f3405 commit 270fbfb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

eth/peer.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ func (p *peer) broadcastBlocks() {
155155
// node internals and at the same time rate limits queued data.
156156
func (p *peer) broadcastTransactions() {
157157
var (
158-
queue []common.Hash // Queue of hashes to broadcast as full transactions
159-
done chan struct{} // Non-nil if background broadcaster is running
160-
fail = make(chan error) // Channel used to receive network error
158+
queue []common.Hash // Queue of hashes to broadcast as full transactions
159+
done chan struct{} // Non-nil if background broadcaster is running
160+
fail = make(chan error, 1) // Channel used to receive network error
161161
)
162162
for {
163163
// If there's no in-flight broadcast running, check if a new one is needed
@@ -217,9 +217,9 @@ func (p *peer) broadcastTransactions() {
217217
// node internals and at the same time rate limits queued data.
218218
func (p *peer) announceTransactions() {
219219
var (
220-
queue []common.Hash // Queue of hashes to announce as transaction stubs
221-
done chan struct{} // Non-nil if background announcer is running
222-
fail = make(chan error) // Channel used to receive network error
220+
queue []common.Hash // Queue of hashes to announce as transaction stubs
221+
done chan struct{} // Non-nil if background announcer is running
222+
fail = make(chan error, 1) // Channel used to receive network error
223223
)
224224
for {
225225
// If there's no in-flight announce running, check if a new one is needed

0 commit comments

Comments
 (0)