git ssb

6+

Dominic / epidemic-broadcast-trees



Tree: 61537ea49c1a1f22f2d8f0ef263fdbef5f2d5e7d

Files: 61537ea49c1a1f22f2d8f0ef263fdbef5f2d5e7d / invariants.js

622 bytesRaw
1var u = require('./util')
2
3module.exports = function (cState) {
4 if(u.isMessage(cState.nodeState.ready)) {
5 if(cState.nodeState.ready.sequence < cState.nodeState.remote.req)
6 throw new Error('about to send older than requested message')
7 if(cState.nodeState.remote.seq != null && cState.nodeState.ready.sequence <= cState.nodeState.remote.seq)
8 throw new Error('about to send an older message than already sent')
9 if(cState.nodeState.ready.sequence > Math.max(cState.nodeState.remote.seq, cState.nodeState.remote.req) + 1)
10 throw new Error('about to send a newer message than expected')
11 }
12}
13
14
15
16
17

Built with git-ssb-web