Skip to content
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

Merged
merged 2 commits into from
Jan 11, 2021
Merged

eth: improve log message #22146

merged 2 commits into from
Jan 11, 2021

Conversation

MariusVanDerWijden
Copy link
Member

@MariusVanDerWijden MariusVanDerWijden commented Jan 7, 2021

also fixes a typo

Copy link

@DGKSK8LIFE DGKSK8LIFE left a 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))
Copy link
Contributor

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

Copy link
Member Author

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

Copy link
Contributor

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)

Copy link
Member Author

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

@MariusVanDerWijden MariusVanDerWijden changed the title eth: fixed typos eth: improve log message Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants