Files: da8b90d365d449e737c606b1ba23cc612834778e / invariants.js
622 bytesRaw
1 | var u = require('./util') |
2 | |
3 | module.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