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

[Wallet] Fix staking balance calculation #1369

Merged

Conversation

random-zebra
Copy link

exclude delegated balance and locked coins (if any)

@random-zebra random-zebra added this to the 4.1.0 milestone Mar 2, 2020
@random-zebra random-zebra self-assigned this Mar 2, 2020
src/wallet/wallet.cpp Outdated Show resolved Hide resolved
@random-zebra random-zebra force-pushed the 2020_wallet_GetStakingBalance branch from e1e0fbf to c70955d Compare March 3, 2020 16:48
@random-zebra
Copy link
Author

Refactored GetStakingBalance using a single loop as per @furszy 's suggestion.
Also fixed two bugs:

  • do not count those coins that don't have the required stake depth
  • prevent possible negative values for balances after the loop

src/wallet/wallet.cpp Outdated Show resolved Hide resolved
src/wallet/wallet.cpp Outdated Show resolved Hide resolved
src/wallet/wallet.cpp Outdated Show resolved Hide resolved
src/wallet/wallet.cpp Outdated Show resolved Hide resolved
exclude delegated balance and locked coins (if any)
@random-zebra random-zebra force-pushed the 2020_wallet_GetStakingBalance branch from c70955d to b496d04 Compare March 3, 2020 20:01
@random-zebra
Copy link
Author

Fixed LOCKs.

Note: with #1373 GetStakingBalance becomes useless.
We could keep it anyway to call it on demand by getstakingstatus with #1368.

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now 👍 , ACK b496d04.

@random-zebra random-zebra merged commit bb9b762 into PIVX-Project:master Mar 11, 2020
akshaynexus pushed a commit to ZENZO-Ecosystem/ZENZO-Core that referenced this pull request Mar 13, 2020
b496d04 [Wallet] Fix staking balance calculation (random-zebra)

Pull request description:

  exclude delegated balance and locked coins (if any)

ACKs for top commit:
  furszy:
    Looks good now 👍 , ACK b496d04.

Tree-SHA512: b4ac9a7cff971e02d7d567c6ec19d69534559500c4b94e6e6de5d44ce28bcd51e6eac9f74a835c4ccfb81b3d629341a6ec4be1c0f1b67a4ba5f1b142a267939a
akshaynexus pushed a commit to ZENZO-Ecosystem/ZENZO-Core that referenced this pull request Mar 15, 2020
b496d04 [Wallet] Fix staking balance calculation (random-zebra)

Pull request description:

  exclude delegated balance and locked coins (if any)

ACKs for top commit:
  furszy:
    Looks good now 👍 , ACK b496d04.

Tree-SHA512: b4ac9a7cff971e02d7d567c6ec19d69534559500c4b94e6e6de5d44ce28bcd51e6eac9f74a835c4ccfb81b3d629341a6ec4be1c0f1b67a4ba5f1b142a267939a
@random-zebra random-zebra deleted the 2020_wallet_GetStakingBalance branch September 24, 2020 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants