Skip to content
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

fixes getUnspentNotes when confirmations >= chain length #3632

Merged
merged 1 commit into from
Mar 10, 2023

Conversation

hughy
Copy link
Contributor

@hughy hughy commented Mar 9, 2023

Summary

if the length of the chain is shorter than or equal to the confirmation range then we calculate a non-positive number for the maximum confirmed sequence. this results in an error when attempting to construct a key range for loading unspent notes from the unspentNoteHashes index.

the genesis block is always confirmed, so the maximum confirmed sequence can never be less than 1.

fixes getUnspentNotes by setting maxConfirmedSequence to be at least 1.

Testing Plan

  • added unit test
  • steps to reproduce error:
> yarn start start -d ~/.ironfish-1
> yarn start wallet:import -d ~/.ironfish-1
> yarn start wallet:rescan --reset -d ~/.ironfish-1
> yarn start wallet:send --rawTransaction --offline --datadir=~/.ironfish-1 -t 0e0e42628ae521b5971b6a6c0384e41a623e6332249f86ef080184440d5e0840 -a 1 -o 0.00000001

receive error The value of "value" is out of range. It must be >= 0 and <= 4294967295. Received -1 before applying chanes

Documentation

Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference
)? If yes, link a
related documentation pull request for the website.

[ ] Yes

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and
what additional work is required, if any.

[ ] Yes

if the length of the chain is shorter than or equal to the confirmation range
then we calculate a non-positive number for the maximum confirmed sequence. this
results in an error when attempting to construct a key range for loading unspent
notes from the unspentNoteHashes index.

the genesis block is always confirmed, so the maximum confirmed sequence can
never be less than 1.

fixes getUnspentNotes by setting maxConfirmedSequence to be at least 1.
@hughy hughy requested a review from a team as a code owner March 9, 2023 23:09
@hughy hughy requested a review from ygao76 March 9, 2023 23:09
@ygao76 ygao76 merged commit 610088b into staging Mar 10, 2023
@ygao76 ygao76 deleted the fix/unspent-notes-confirmations branch March 10, 2023 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants