go-libp2p-circuit icon indicating copy to clipboard operation
go-libp2p-circuit copied to clipboard

Don't add 1 weight to both sides of connections we're relaying

Open Stebalien opened this issue 5 years ago • 6 comments

When relaying a connection between two peers, we currently add 1 weight in the connection manager to both connections involved. Instead, we should just give peers using us a flag weight of 1 total.

Stebalien avatar Jun 05 '20 21:06 Stebalien

Not sure what you mean here -- shouldn't both connections get some weight?

vyzo avatar Jun 05 '20 21:06 vyzo

Note that the rules for the relays themselves are quite different from normal node; we want to preserve the connections with the highest load.

vyzo avatar Jun 05 '20 21:06 vyzo

Also note that we can't assign fractional values to tags (say 0.5), so this can't work.

vyzo avatar Jun 05 '20 22:06 vyzo

IMO, all users of a relay should be considered equal. Otherwise, an abuser could make a bunch of fake relay connections to boost their score.

Honestly, we should probably prefer peers with fewer connections.

Stebalien avatar Jun 06 '20 00:06 Stebalien

I can make it upsert tags up to (say) 10, and above that overflow to an internal counter for house keeping activities (ie when to upser the tag to 0). This way peers with a number of relay connections get a small boost, but once they have enough connections they are considered equal.

vyzo avatar Jun 06 '20 11:06 vyzo

SGTM.

Stebalien avatar Jun 08 '20 19:06 Stebalien