omgnetwork / plasma-mvp

OmiseGO's research implementation of Minimal Viable Plasma
MIT License
561 stars 158 forks source link

Fix priority queue and add tests #105

Closed smartcontracts closed 6 years ago

smartcontracts commented 6 years ago

Fixes #103 and adds/refactors tests so this doesn't happen again. Implements the suggestions by @laskdaf.

PriorityQueue.getMin() when the set is empty now throws. I think this is the most sensible behavior because we can't return a null value to represent that the set is empty. As a result, we no longer need to check that exitsQueue.currentSize() > 0 in the while loop condition, but do need to do so before reassigning (utxoPos, created_at) or risk throwing within the loop.

Tests pass.

DavidKnott commented 6 years ago

LGTM, merging