This fixes #16 but introduces a memory leak. The array of nonces is not just a nonce count, but an array of used nonces, which is pretty sequential. Some added logic to merge sequences would probably avoid the memory leak
Fixes issue 18, but introduces a memory leak (the nonce counts). They…
… do expire after a while, but the overhead might be problematic if you have too many requests.
lol, I meant issue #16...
I think this is not the best way to proceed, because idea of nonce count is ignored simply. I will try to find better fix for issue #16. Thanks for your help.
Yeah, this pull request was mostly a way of exposing the flaw, I guess.
Would it be better to e.g. merge consecutive nonce counters? Say you get a request with nc 1, 2, 3, 4, 6, 7 and 8. The array could contain tuples in some way indicating the ranges of "used nonce counts": 1..4, 6..8. When a request for nc 5 arrives (due to e.g. network latency) it's all good, and the ranges merge to 1..8.
Do clients always send sequential nonce counters? Is it required?