@@ -1120,6 +1120,11 @@ func (vm *VM) initBlockBuilding() error {
11201120 vm .builder = vm .NewBlockBuilder (vm .toEngine )
11211121 vm .builder .awaitSubmittedTxs ()
11221122
1123+ var p2pValidators p2p.ValidatorSet = & validatorSet {}
1124+ if vm .config .PullGossipFrequency .Duration > 0 {
1125+ p2pValidators = vm .p2pValidators
1126+ }
1127+
11231128 if vm .ethTxGossipHandler == nil {
11241129 vm .ethTxGossipHandler = newTxGossipHandler [* GossipEthTx ](
11251130 vm .ctx .Log ,
@@ -1129,7 +1134,7 @@ func (vm *VM) initBlockBuilding() error {
11291134 txGossipTargetMessageSize ,
11301135 txGossipThrottlingPeriod ,
11311136 txGossipThrottlingLimit ,
1132- vm . p2pValidators ,
1137+ p2pValidators ,
11331138 )
11341139 }
11351140
@@ -1146,7 +1151,7 @@ func (vm *VM) initBlockBuilding() error {
11461151 txGossipTargetMessageSize ,
11471152 txGossipThrottlingPeriod ,
11481153 txGossipThrottlingLimit ,
1149- vm . p2pValidators ,
1154+ p2pValidators ,
11501155 )
11511156 }
11521157
@@ -1171,15 +1176,20 @@ func (vm *VM) initBlockBuilding() error {
11711176 }
11721177 }
11731178
1174- vm .shutdownWg .Add (2 )
1175- go func () {
1176- gossip .Every (ctx , vm .ctx .Log , ethTxPushGossiper , vm .config .PushGossipFrequency .Duration )
1177- vm .shutdownWg .Done ()
1178- }()
1179- go func () {
1180- gossip .Every (ctx , vm .ctx .Log , vm .ethTxPullGossiper , vm .config .PullGossipFrequency .Duration )
1181- vm .shutdownWg .Done ()
1182- }()
1179+ if vm .config .PushGossipFrequency .Duration > 0 {
1180+ vm .shutdownWg .Add (1 )
1181+ go func () {
1182+ gossip .Every (ctx , vm .ctx .Log , ethTxPushGossiper , vm .config .PushGossipFrequency .Duration )
1183+ vm .shutdownWg .Done ()
1184+ }()
1185+ }
1186+ if vm .config .PullGossipFrequency .Duration > 0 {
1187+ vm .shutdownWg .Add (1 )
1188+ go func () {
1189+ gossip .Every (ctx , vm .ctx .Log , vm .ethTxPullGossiper , vm .config .PullGossipFrequency .Duration )
1190+ vm .shutdownWg .Done ()
1191+ }()
1192+ }
11831193
11841194 if vm .atomicTxPullGossiper == nil {
11851195 atomicTxPullGossiper := gossip .NewPullGossiper [* atomic.GossipAtomicTx ](
@@ -1198,15 +1208,20 @@ func (vm *VM) initBlockBuilding() error {
11981208 }
11991209 }
12001210
1201- vm .shutdownWg .Add (2 )
1202- go func () {
1203- gossip .Every (ctx , vm .ctx .Log , vm .atomicTxPushGossiper , vm .config .PushGossipFrequency .Duration )
1204- vm .shutdownWg .Done ()
1205- }()
1206- go func () {
1207- gossip .Every (ctx , vm .ctx .Log , vm .atomicTxPullGossiper , vm .config .PullGossipFrequency .Duration )
1208- vm .shutdownWg .Done ()
1209- }()
1211+ if vm .config .PushGossipFrequency .Duration > 0 {
1212+ vm .shutdownWg .Add (1 )
1213+ go func () {
1214+ gossip .Every (ctx , vm .ctx .Log , vm .atomicTxPushGossiper , vm .config .PushGossipFrequency .Duration )
1215+ vm .shutdownWg .Done ()
1216+ }()
1217+ }
1218+ if vm .config .PullGossipFrequency .Duration > 0 {
1219+ vm .shutdownWg .Add (1 )
1220+ go func () {
1221+ gossip .Every (ctx , vm .ctx .Log , vm .atomicTxPullGossiper , vm .config .PullGossipFrequency .Duration )
1222+ vm .shutdownWg .Done ()
1223+ }()
1224+ }
12101225
12111226 return nil
12121227}
0 commit comments