status-go icon indicating copy to clipboard operation
status-go copied to clipboard

Waku host has special behaviour if a peer has `confirmations-enabled` set to true

Open Samyoul opened this issue 5 years ago • 1 comments
trafficstars

Problem

Currently the Waku implementation has special behaviour that appears to send a message in response to receiving a message from a peer that has its confirmations-enabled set to true.

https://github.com/status-im/status-go/blob/2d13ccf5ec3db7e48d7a96a7954be57edb96f12f/waku/v1/peer.go#L535-L547

        // mark envelopes only if they were successfully sent
        for _, e := range bundle {
p.Mark(e)
event := common.EnvelopeEvent{
Event: common.EventEnvelopeSent,
Hash: e.Hash(),
Peer: p.EnodeID(),
}
if p.confirmationsEnabled {
event.Batch = batchHash
}
p.host.SendEnvelopeEvent(event)
        }

Which seems to check if the peer's status-option.ConfirmationsEnabled is true. If true add the batchHash to the EnvelopeEvent. This pushes the EnvelopeEvent on to the event queue. The protocol\transport\waku event handler checks if the event.Batch is equal to event.Hash, if it is m.handler.EnvelopeSent() is triggered, this seems to be the trigger for sending the message confirmation.

Which seems to suggest that if a peer has a its confirmations-enabled set to true, the host should send a confirmation.

See https://github.com/vacp2p/specs/pull/128#discussion_r427771425

Implementation

  • [ ] Fully understand the process and detail it
  • [ ] Decide if this functionality is required
  • [ ] Implement any changes to the code (if not needed remove the extra behaviour when a peer has confirmations-enabled)

Samyoul avatar May 21 '20 13:05 Samyoul

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

status-github-bot[bot] avatar Aug 05 '21 15:08 status-github-bot[bot]