Skip to content

mixpool: Limit caching of KE messages #3795

Description

@jholdstock

Every message type apart from KE goes through the following check in AcceptMessage to ensure only one message of each type per identity per session:

dcrd/mixing/mixpool/mixpool.go

Lines 1302 to 1315 in 3836103

// Check that a message from this identity does not conflict with a
// different message of the same type in the session.
var haveKE bool
for _, prevHash := range p.messagesByIdentity[*id] {
e := p.pool[prevHash]
if e.msgtype == msgtype && bytes.Equal(e.msg.Sid(), msg.Sid()) {
return nil, ruleError(fmt.Errorf("message %v by identity %x "+
"in session %x conflicts with already accepted message %v",
hash, *id, msg.Sid(), prevHash))
}
if !haveKE && e.msgtype == msgtypeKE && bytes.Equal(e.msg.Sid(), msg.Sid()) {
haveKE = true
}
}

Not applying this check to KE messages means there is no upper bound on how many KE messages can be sent by a single peer and an unlimited number of these messages will be cached in memory.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions