Skip to content

Commit a963680

Browse files
authored
fix!: reportMessageValidationResult to accept peer id string (#432)
fix: reportMessageValidationResult to accept peer id string
1 parent e2505d6 commit a963680

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2139,7 +2139,7 @@ export class GossipSub extends EventEmitter<GossipsubEvents> implements PubSub<G
21392139
*
21402140
* This should only be called once per message.
21412141
*/
2142-
reportMessageValidationResult(msgId: MsgIdStr, propagationSource: PeerId, acceptance: TopicValidatorResult): void {
2142+
reportMessageValidationResult(msgId: MsgIdStr, propagationSource: PeerIdStr, acceptance: TopicValidatorResult): void {
21432143
let cacheEntry: MessageCacheRecord | null
21442144

21452145
if (acceptance === TopicValidatorResult.Accept) {
@@ -2148,9 +2148,9 @@ export class GossipSub extends EventEmitter<GossipsubEvents> implements PubSub<G
21482148
if (cacheEntry != null) {
21492149
const { message: rawMsg, originatingPeers } = cacheEntry
21502150
// message is fully validated inform peer_score
2151-
this.score.deliverMessage(propagationSource.toString(), msgId, rawMsg.topic)
2151+
this.score.deliverMessage(propagationSource, msgId, rawMsg.topic)
21522152

2153-
this.forwardMessage(msgId, cacheEntry.message, propagationSource.toString(), originatingPeers)
2153+
this.forwardMessage(msgId, cacheEntry.message, propagationSource, originatingPeers)
21542154
}
21552155
// else, Message not in cache. Ignoring forwarding
21562156
}
@@ -2165,7 +2165,7 @@ export class GossipSub extends EventEmitter<GossipsubEvents> implements PubSub<G
21652165

21662166
// Tell peer_score about reject
21672167
// Reject the original source, and any duplicates we've seen from other peers.
2168-
this.score.rejectMessage(propagationSource.toString(), msgId, rawMsg.topic, rejectReason)
2168+
this.score.rejectMessage(propagationSource, msgId, rawMsg.topic, rejectReason)
21692169
for (const peer of originatingPeers) {
21702170
this.score.rejectMessage(peer, msgId, rawMsg.topic, rejectReason)
21712171
}

0 commit comments

Comments
 (0)