protocol-diver / go-gossip

Go implementation of the Gossip protocol
BSD 3-Clause "New" or "Revised" License
10 stars 0 forks source link

Need to improve message store for broadcast #2

Closed dbadoy closed 1 year ago

dbadoy commented 1 year ago

When a message is received from another peer, this library stores it for a certain period of time, uses it to determine whether it has already received it, and is used to deliver data when requested by another node. Therefore, if the holding time is too short, messages that have already been received are recognized as new messages and can be accepted even if it has already been received. And if it is too long, the stored messages increase rapidly, and it making normal propagation impossible. I've been thinking about finding an appropriate number and trying to compromise, but I think the data structure itself is wrong.

I think the solution is to divide the module that checks whether a message is received and the database module for delivery. IMO, could be fine if use a bloom filter to check if a message has been received and use the MFU cache for message propagation.