-
Notifications
You must be signed in to change notification settings - Fork 32
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
tokenUtxoDetails: fixed bug where UTXO array elems would switch #81
Conversation
thisUtxo.vout !== 1 // UTXO is not the reciever of the genesis or mint tokens. | ||
) { | ||
// Can safely be marked as false. | ||
outAry[i] = false |
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.
These are the main changes in this PR. They center around more careful handling of the arrays and their elements.
} | ||
} | ||
} | ||
|
||
return validations | ||
return outAry |
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.
I changed the output variable name from validations
to outAry
. That's confusing git diff, and making it appear that I changed much more code than I actually did.
@@ -210,12 +210,12 @@ describe("#Utils", () => { | |||
// Mock the call to rest.bitcoin.com | |||
if (process.env.TEST === "unit") { | |||
sandbox | |||
.stub(axios, "get") | |||
.stub(axios, "post") |
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.
I fixed this minor mocking bug while I was at it.
@@ -1059,5 +1059,106 @@ describe("#Utils", () => { | |||
"tokenQty" | |||
]) | |||
}) | |||
|
|||
it("should process problematic utxos", async () => { |
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.
I added this new test case, based on the UTXOs that were causing the bug for Pete. This new test case will ensure we don't see this bug again.
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.
👍
🎉 This PR is included in version 4.9.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR fixes a bug that Pete discovered in tokenUtxoDetails. The bug was triggered inconsistently. It was caused by the the elements in a UTXO array getting out-of-order compared to the validatedTxid array. The changes to code fix it by using the
Array.filter
method to make sure the right array element is being selected.The changes in this PR effect only two files. The rest are compiler noise.