-
Notifications
You must be signed in to change notification settings - Fork 20.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eth: improve log message #22146
eth: improve log message #22146
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Make sure that ethPeersWithoutTransacion
isn't an actual method though.
eth/handler.go
Outdated
|
||
// Send the block to a subset of our peers | ||
transfer := peers[:int(math.Sqrt(float64(len(peers))))] | ||
for _, peer := range transfer { | ||
txset[peer] = append(txset[peer], tx.Hash()) | ||
} | ||
log.Trace("Broadcast transaction", "hash", tx.Hash(), "recipients", len(peers)) | ||
log.Trace("Broadcast transaction", "hash", tx.Hash(), "recipients", len(txset)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not a typo fix -- pretty certain that changes the semantics of the message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it changes the message from logging all peers to only logging the peers that we actually send the transaction to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite, does it? The len(txset)
will grow for each transaction.. ?
So if txs
are two transactoins, and tx1 is sent to peerA
, then txset will have one key, peerA
.
If tx2
is sent only to peerB
, then the key peerB
will be added to txset
, and len(txset)
will be 2
, not 1
.
I think what you want is len(transfer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh I meant to put len(transfer)
, sorry
also fixes a typo