decred / dcrd

Decred daemon in Go (golang).
https://decred.org
ISC License
731 stars 289 forks source link

mixpool: Cache recently removed msgs. #3366

Closed davecgh closed 1 month ago

davecgh commented 1 month ago

This requires #3360 and is rebased on #3362.

This adds a cache to house mix messages that have recently been removed from the mixpool. It makes use of the new container/lru module to handle automatic expiration of entries and maximum entry limiting.

The rationale for this change is that it is considered misbehavior to advertise a mix message and then claim it is not found when the corresponding request arrives. Maintaining a separate cache of mix messages recently removed from the mixpool for a short period of time significantly increases the probability they are available to serve when a request for the advertisement arrives independent of the current status of the mixpool.