Peer.broadcastBlocksPoW¶
| Source (upstream pre-purge) | Current | |
|---|---|---|
| File | eth/protocols/eth/broadcast.go |
peer_pow.go |
| Symbol | Peer.broadcastBlocks |
Peer.broadcastBlocksPoW |
| Ref | f4d53133f~1 |
etc/v1.17.3-full-node |
Renamed from broadcastBlocks. Channels moved to powExt wrapper.
3-way merge — purge → getc ← upstream¶
pre-purge≈ adapted (origin inferred by similarity)fork-only
// broadcastBlocksPoW is a write loop that multiplexes blocks and block announcements
↗// to the remote peer. The goal is to have an async writer that does not lock up
// node internals and at the same time rate limits queued data.
func (p *Peer) broadcastBlocksPoW() {
↗ for {
select {
≈ case prop := <-p.powExt.queuedBlocks:
↗ if err := p.SendNewBlock(prop.block, prop.td); err != nil {
return
}
p.Log().Trace("Propagated block", "number", prop.block.Number(), "hash", prop.block.Hash(), "td", prop.td)
≈ case block := <-p.powExt.queuedBlockAnns:
↗ if err := p.SendNewBlockHashes([]common.Hash{block.Hash()}, []uint64{block.NumberU64()}); err != nil {
return
}
p.Log().Trace("Announced block", "number", block.Number(), "hash", block.Hash())
↗ case <-p.term:
return
}
}
}
core-geth validation — +4 -4
| | | |---|---| | File | [`broadcast.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/eth/protocols/eth/broadcast.go) | | Symbol | `Peer.broadcastBlocks` | | Ref | `v1.12.20` |--- a/core-geth/eth/protocols/eth/broadcast.go
+++ b/etc/eth/protocols/eth/peer_pow.go
@@ -1,16 +1,16 @@
-// broadcastBlocks is a write loop that multiplexes blocks and block announcements
+// broadcastBlocksPoW is a write loop that multiplexes blocks and block announcements
// to the remote peer. The goal is to have an async writer that does not lock up
// node internals and at the same time rate limits queued data.
-func (p *Peer) broadcastBlocks() {
+func (p *Peer) broadcastBlocksPoW() {
for {
select {
- case prop := <-p.queuedBlocks:
+ case prop := <-p.powExt.queuedBlocks:
if err := p.SendNewBlock(prop.block, prop.td); err != nil {
return
}
p.Log().Trace("Propagated block", "number", prop.block.Number(), "hash", prop.block.Hash(), "td", prop.td)
- case block := <-p.queuedBlockAnns:
+ case block := <-p.powExt.queuedBlockAnns:
if err := p.SendNewBlockHashes([]common.Hash{block.Hash()}, []uint64{block.NumberU64()}); err != nil {
return
}