Skip to content

Commit 6f39fff

Browse files
committed
feat(p2p): non-strict severe reputation events
This allows severe reputation events to be registered even when not running in strict mode. Previously only manual reputation events were allowed when not in strict mode.
1 parent 2a5f74c commit 6f39fff

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: lib/p2p/Pool.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,15 @@ class Pool extends EventEmitter {
928928
peer.on('reputation', async (event) => {
929929
this.logger.debug(`Peer (${peer.label}): reputation event: ${ReputationEvent[event]}`);
930930
if (peer.nodePubKey) {
931-
// we only add manual reputation events when not in strict mode to prevent unintentional bans
932-
if (this.strict || event === ReputationEvent.ManualBan || event === ReputationEvent.ManualUnban) {
931+
// when in strict mode, we add all reputation events
932+
// otherwise, we only add manual or severe reputation events to prevent unintentional bans
933+
if (this.strict
934+
|| event === ReputationEvent.ManualBan
935+
|| event === ReputationEvent.ManualUnban
936+
|| event === ReputationEvent.SwapAbuse
937+
|| event === ReputationEvent.SwapMisbehavior
938+
|| event === ReputationEvent.WireProtocolErr
939+
|| event === ReputationEvent.InvalidAuth) {
933940
await this.addReputationEvent(peer.nodePubKey, event);
934941
}
935942
}

0 commit comments

Comments
 (0)