-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Integration tests running async causing wrong balance #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Should be ready to go now. |
|
+1 |
|
TBH, I'm not a big fan of how much this PR complicates the simple integration test. I'm in favor of using random addresses to address the race condition. But I'd rather drop the fee + min spendable calculation stuff. Just draw an small amount from faucet every time. We can return the amount back to faucet with an |
|
@weilu I cleaned it up as per your request. We can't easily do an While I think this pull request is still worthwhile, I've realised there still exists a race condition over which unspent is used. |
test/integration/p2sh.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot simply throw here, need to call done(), otherwise on error the test will timeout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed and rebased on master.
Integration tests running async causing wrong balance
As can be seen after a small commit to just the README, the build has switched from
passingtofailed.The error is an
Uncaught AssertionError: 18600000 == 18500000, that is, the funds received on that address were more than expected.Knowing that the assertion code is actually:
It received twice as much as it should. This indicates that the code was run twice before the assertion was made.
Looking at the transaction history, it can be seen that the two transactions around this time were performed asynchronously.
To resolve this, I have made the following changes:
targetAddressis now a random address.targetAddressbalance, if we regenerate an address with a non-zero balance, a failing integration test would be the least of our worries.