Skip to content

Commit 4b15f7e

Browse files
committed
fix: disable tx fetching
1 parent b686044 commit 4b15f7e

File tree

2 files changed

+46
-38
lines changed

2 files changed

+46
-38
lines changed

p2p/log.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ func (count *MessageCount) Load() MessageCount {
4343
Pings: atomic.LoadInt64(&count.Pings),
4444
Errors: atomic.LoadInt64(&count.Errors),
4545
Disconnects: atomic.LoadInt64(&count.Disconnects),
46+
NewWitness: atomic.LoadInt64(&count.NewWitness),
47+
NewWitnessHashes: atomic.LoadInt64(&count.NewWitnessHashes),
48+
GetWitnessRequest: atomic.LoadInt64(&count.GetWitnessRequest),
49+
Witness: atomic.LoadInt64(&count.Witness),
4650
}
4751
}
4852

@@ -60,6 +64,10 @@ func (count *MessageCount) Clear() {
6064
atomic.StoreInt64(&count.Pings, 0)
6165
atomic.StoreInt64(&count.Errors, 0)
6266
atomic.StoreInt64(&count.Disconnects, 0)
67+
atomic.StoreInt64(&count.NewWitness, 0)
68+
atomic.StoreInt64(&count.NewWitnessHashes, 0)
69+
atomic.StoreInt64(&count.GetWitnessRequest, 0)
70+
atomic.StoreInt64(&count.Witness, 0)
6371
}
6472

6573
// IsEmpty checks whether the sum of all the counts is empty. Make sure to call

p2p/rlpx.go

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -197,26 +197,26 @@ func (c *rlpxConn) ReadAndServe(count *MessageCount) error {
197197

198198
var hashes []common.Hash
199199
for _, hash := range *msg {
200-
headersRequest := &GetBlockHeaders{
201-
GetBlockHeadersRequest: &eth.GetBlockHeadersRequest{
202-
// Providing both the hash and number will result in a `both origin
203-
// hash and number` error.
204-
Origin: eth.HashOrNumber{Hash: hash.Hash},
205-
Amount: 1,
206-
},
207-
}
208-
209-
if err := c.Write(headersRequest); err != nil {
210-
c.logger.Error().Err(err).Msg("Failed to write GetBlockHeaders request")
211-
}
212-
213-
bodiesRequest := &GetBlockBodies{
214-
GetBlockBodiesRequest: []common.Hash{hash.Hash},
215-
}
216-
217-
if err := c.Write(bodiesRequest); err != nil {
218-
c.logger.Error().Err(err).Msg("Failed to write GetBlockBodies request")
219-
}
200+
// headersRequest := &GetBlockHeaders{
201+
// GetBlockHeadersRequest: &eth.GetBlockHeadersRequest{
202+
// // Providing both the hash and number will result in a `both origin
203+
// // hash and number` error.
204+
// Origin: eth.HashOrNumber{Hash: hash.Hash},
205+
// Amount: 1,
206+
// },
207+
// }
208+
//
209+
// if err := c.Write(headersRequest); err != nil {
210+
// c.logger.Error().Err(err).Msg("Failed to write GetBlockHeaders request")
211+
// }
212+
//
213+
// bodiesRequest := &GetBlockBodies{
214+
// GetBlockBodiesRequest: []common.Hash{hash.Hash},
215+
// }
216+
217+
// if err := c.Write(bodiesRequest); err != nil {
218+
// c.logger.Error().Err(err).Msg("Failed to write GetBlockBodies request")
219+
// }
220220

221221
hashes = append(hashes, hash.Hash)
222222
}
@@ -244,29 +244,29 @@ func (c *rlpxConn) ReadAndServe(count *MessageCount) error {
244244
log.Error().Err(err).Msg("Failed to write GetWitnessPacket request")
245245
}
246246
case *Transactions:
247-
atomic.AddInt64(&count.Transactions, int64(len(*msg)))
248-
c.logger.Trace().Msgf("Received %v Transactions", len(*msg))
247+
// atomic.AddInt64(&count.Transactions, int64(len(*msg)))
248+
// c.logger.Trace().Msgf("Received %v Transactions", len(*msg))
249249
case *PooledTransactions:
250-
atomic.AddInt64(&count.Transactions, int64(len(msg.PooledTransactionsResponse)))
251-
c.logger.Trace().Msgf("Received %v PooledTransactions", len(msg.PooledTransactionsResponse))
250+
// atomic.AddInt64(&count.Transactions, int64(len(msg.PooledTransactionsResponse)))
251+
// c.logger.Trace().Msgf("Received %v PooledTransactions", len(msg.PooledTransactionsResponse))
252252
case *NewPooledTransactionHashes:
253-
if err := c.processNewPooledTransactionHashes(count, msg.Hashes); err != nil {
254-
return err
255-
}
253+
// if err := c.processNewPooledTransactionHashes(count, msg.Hashes); err != nil {
254+
// return err
255+
// }
256256
case *NewPooledTransactionHashes66:
257-
if err := c.processNewPooledTransactionHashes(count, *msg); err != nil {
258-
return err
259-
}
257+
// if err := c.processNewPooledTransactionHashes(count, *msg); err != nil {
258+
// return err
259+
// }
260260
case *GetPooledTransactions:
261-
atomic.AddInt64(&count.TransactionRequests, int64(len(msg.GetPooledTransactionsRequest)))
262-
c.logger.Trace().Msgf("Received %v GetPooledTransactions request", len(msg.GetPooledTransactionsRequest))
261+
// atomic.AddInt64(&count.TransactionRequests, int64(len(msg.GetPooledTransactionsRequest)))
262+
// c.logger.Trace().Msgf("Received %v GetPooledTransactions request", len(msg.GetPooledTransactionsRequest))
263263

264-
res := &PooledTransactions{
265-
RequestId: msg.RequestId,
266-
}
267-
if err := c.Write(res); err != nil {
268-
c.logger.Error().Err(err).Msg("Failed to write PooledTransactions response")
269-
}
264+
// res := &PooledTransactions{
265+
// RequestId: msg.RequestId,
266+
// }
267+
// if err := c.Write(res); err != nil {
268+
// c.logger.Error().Err(err).Msg("Failed to write PooledTransactions response")
269+
// }
270270
case *Error:
271271
atomic.AddInt64(&count.Errors, 1)
272272
c.logger.Trace().Err(msg.Unwrap()).Msg("Received Error")

0 commit comments

Comments
 (0)