hypercore-one / syrius

MIT License
0 stars 0 forks source link

Prevent the same hash from being added twice into the auto receive tx pool #31

Closed vilkris4 closed 1 year ago

vilkris4 commented 1 year ago

Since the addHash function contains asynchronous code, it is possible to add the same hash into the pool more than once, if the function is called in short succession.

This fix checks that the hash is not in the pool after the asynchronous code has run.

vilkris4 commented 1 year ago

Added a comment to the function. The check is essentially the same that is in the original code: https://github.com/hypercore-one/syrius/blob/master/lib/blocs/auto_receive_tx_worker.dart#L85-L98