@@ -93,6 +93,9 @@ type handlerConfig struct {
9393 Checkpoint * params.TrustedCheckpoint // Hard coded checkpoint for sync challenges
9494 Whitelist map [uint64 ]common.Hash // Hard coded whitelist for sync challenged
9595 ShadowForkPeerIDs []string // List of peer ids that take part in the shadow-fork
96+
97+ DisableTxBroadcast bool
98+ DisableTxReceiving bool
9699}
97100
98101type handler struct {
@@ -131,7 +134,9 @@ type handler struct {
131134 wg sync.WaitGroup
132135 peerWG sync.WaitGroup
133136
134- shadowForkPeerIDs []string
137+ shadowForkPeerIDs []string
138+ disableTxBroadcast bool
139+ disableTxReceiving bool
135140}
136141
137142// newHandler returns a handler for all Ethereum chain management protocol.
@@ -141,16 +146,18 @@ func newHandler(config *handlerConfig) (*handler, error) {
141146 config .EventMux = new (event.TypeMux ) // Nicety initialization for tests
142147 }
143148 h := & handler {
144- networkID : config .Network ,
145- forkFilter : forkid .NewFilter (config .Chain ),
146- eventMux : config .EventMux ,
147- database : config .Database ,
148- txpool : config .TxPool ,
149- chain : config .Chain ,
150- peers : newPeerSet (),
151- whitelist : config .Whitelist ,
152- quitSync : make (chan struct {}),
153- shadowForkPeerIDs : config .ShadowForkPeerIDs ,
149+ networkID : config .Network ,
150+ forkFilter : forkid .NewFilter (config .Chain ),
151+ eventMux : config .EventMux ,
152+ database : config .Database ,
153+ txpool : config .TxPool ,
154+ chain : config .Chain ,
155+ peers : newPeerSet (),
156+ whitelist : config .Whitelist ,
157+ quitSync : make (chan struct {}),
158+ shadowForkPeerIDs : config .ShadowForkPeerIDs ,
159+ disableTxBroadcast : config .DisableTxBroadcast ,
160+ disableTxReceiving : config .DisableTxReceiving ,
154161 }
155162 if config .Sync == downloader .FullSync {
156163 // The database seems empty as the current block is the genesis. Yet the fast
@@ -415,10 +422,12 @@ func (h *handler) Start(maxPeers int) {
415422 h .maxPeers = maxPeers
416423
417424 // broadcast transactions
418- h .wg .Add (1 )
419- h .txsCh = make (chan core.NewTxsEvent , txChanSize )
420- h .txsSub = h .txpool .SubscribeNewTxsEvent (h .txsCh )
421- go h .txBroadcastLoop ()
425+ if ! h .disableTxBroadcast {
426+ h .wg .Add (1 )
427+ h .txsCh = make (chan core.NewTxsEvent , txChanSize )
428+ h .txsSub = h .txpool .SubscribeNewTxsEvent (h .txsCh )
429+ go h .txBroadcastLoop ()
430+ }
422431
423432 // broadcast mined blocks
424433 h .wg .Add (1 )
0 commit comments