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] clear StakeableCoins before initializing #2109

Merged
merged 1 commit into from
Dec 28, 2020

Conversation

PeterL73
Copy link

Problem

The list of StakeableCoins is growing with every incomming block.

Root Cause

In f935801 a slightly different StakeableCoins initialization was introduced, but the list of StakeableCoins is not cleared before initializing, which causes the list of StakeableCoins to grow with every incomming block.

Solution

Clear StakeableCoins before initializing.

Testing Results

Before

ProcessNewBlock : ACCEPTED Block 5449 in 7 milliseconds with size=511
CreateCoinStake: attempted staking 1 times
SolveProofOfStake : stake not found
CreateCoinStake: attempted staking 1 times
SolveProofOfStake : stake not found
CreateCoinStake: attempted staking 1 times
SolveProofOfStake : stake not found
CheckKernelHash : Proof Of Stake:
ssUniqueID=2c0000001f9fcce856206f2f0122157e3e4ac332da3f7298df8d5fd2da016926e729f44d
nTimeTx=1608543705
hashProofOfStake=00013687d13ebb6afee40cf44033c2f41baa394af495760097168c08d55ccb72
nBits=453257636
weight=131082385330
bnTarget=0001453bc53097d4000000000000000000000000000000000000000000000000 (res: 1)

UpdateTip: new best=2cb1450de56ab75b85d7d0c724d9c0b5fa613809a698513ce8b60d331a5b6cf4  height=5450 version=8  log2_work=58.3826217546884578  tx=10856  date=2020-12-21 09:41:45 progress=1.000000  cache=0.1MiB(587txo)
ProcessNewBlock : ACCEPTED Block 5450 in 7 milliseconds with size=517
CreateCoinStake: attempted staking 2 times
SolveProofOfStake : stake not found
CreateCoinStake: attempted staking 2 times
SolveProofOfStake : stake not found
CheckKernelHash : Proof Of Stake:
ssUniqueID=010000007e7b76750da0f9acaabb6667f285198e96db26dfb5350489ca0886893472a360
nTimeTx=1608543720
hashProofOfStake=000e7625a66fdbdefedfd388d0f9acddb3001c1d905283d0f033cc4ca682e759
nBits=453253235
weight=2022043729136
bnTarget=0013480887a59451000000000000000000000000000000000000000000000000 (res: 1)

UpdateTip: new best=f5eeb1f3d441eef0cba922eaacf406243f5e7292770331bf063757da31bab729  height=5451 version=8  log2_work=58.3828855984372836  tx=10858  date=2020-12-21 09:42:00 progress=0.999994  cache=0.1MiB(592txo)
ProcessNewBlock : ACCEPTED Block 5451 in 6 milliseconds with size=512
CreateCoinStake: attempted staking 3 times
SolveProofOfStake : stake not found
CreateCoinStake: attempted staking 3 times
SolveProofOfStake : stake not found

After

ProcessNewBlock : ACCEPTED Block 5479 in 26 milliseconds with size=512
CreateCoinStake: attempted staking 1 times
SolveProofOfStake : stake not found
CreateCoinStake: attempted staking 1 times
SolveProofOfStake : stake not found
CreateCoinStake: attempted staking 1 times
SolveProofOfStake : stake not found
CheckKernelHash : Proof Of Stake:
ssUniqueID=01000000f18270e29f76bde829f583b159d9e2db02dac17ac9997102e9fbae5defff1c09
nTimeTx=1608545760
hashProofOfStake=00087184a7ddac39c0cb67cc0cddb88a6fcebcb030764833d26e8422143b5cc8
nBits=453334996
weight=2001607996934
bnTarget=0018e6912c241754000000000000000000000000000000000000000000000000 (res: 1)

UpdateTip: new best=be02fd25c84bcaa92596ae531c6292d922c6e4cf19fc6609e1a48290dd48758b  height=5480 version=8  log2_work=58.3894677214790718  tx=10916  date=2020-12-21 10:16:00 progress=0.999994  cache=0.0MiB(58txo)
ProcessNewBlock : ACCEPTED Block 5480 in 29 milliseconds with size=512
CreateCoinStake: attempted staking 1 times
SolveProofOfStake : stake not found
CreateCoinStake: attempted staking 1 times
SolveProofOfStake : stake not found
CreateCoinStake: attempted staking 1 times
SolveProofOfStake : stake not found
CheckKernelHash : Proof Of Stake:
ssUniqueID=12000000a696dcf10b582d62fcdff791797287bf34db3f91fc067fa920c5ae28a59cce47
nTimeTx=1608545805
hashProofOfStake=000050aad911bd0634c1cb2deb2ec35a719ae0e275e7ffdb8d39ca5d9e706978
nBits=453323700
weight=131082385330
bnTarget=000193fe80224ca4000000000000000000000000000000000000000000000000 (res: 1)

UpdateTip: new best=d954a74c595d8470f8730b167c514c72b2bd8d7f0c394699c78195e973caeff7  height=5481 version=8  log2_work=58.3896757156578516  tx=10918  date=2020-12-21 10:16:45 progress=1.000000  cache=0.0MiB(64txo)
ProcessNewBlock : ACCEPTED Block 5481 in 25 milliseconds with size=516
CreateCoinStake: attempted staking 1 times
SolveProofOfStake : stake not found
CreateCoinStake: attempted staking 1 times
SolveProofOfStake : stake not found

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.

Nice catch 👌 , concept ACK.
In a quick first glance, looks like it. Will check it deeper soon.

@random-zebra random-zebra added Block Generation Mining/Staking related issues Bug Needs Backport Placeholder tag for anything needing a backport to prior version branches labels Dec 27, 2020
@random-zebra random-zebra added this to the 5.0.0 milestone Dec 27, 2020
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

Yes, good catch 👍 utACK f12af33

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.

ACK f12af33

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

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

utACK f12af33

@Fuzzbawls Fuzzbawls merged commit 57c807e into PIVX-Project:master Dec 28, 2020
Fuzzbawls pushed a commit to Fuzzbawls/PIVX that referenced this pull request Dec 28, 2020
random-zebra added a commit that referenced this pull request Dec 28, 2020
41abf5a clear StakeableCoins before initializing (PeterL73)
3de9861 [Policy] Set DEFAULT_SHIELDEDTXFEE_K to 100 (from 1000) (random-zebra)
4a8e571 [BUG] Fix total budget on testnet (random-zebra)
4285bee scripted-diff: Fix "alloted" typo (random-zebra)
107529b Tests: check getbudgetinfo / getbudgetprojection updated output (random-zebra)
495c546 Tests: check invalid RPC inputs in rpc_budget test (random-zebra)
723a41b Consensus: enforce that proposal BlockStart must be a superblock (random-zebra)
5fb488a Consensus: enforce proposal max payments (6 main-net / 20 test-net) (random-zebra)
6377883 [BUG][Tests] Fix remote nodes switched ports in PivxTier2TestFramework (random-zebra)
73864a0 Startup: move masternode port validation inside `initMasternode`. (furszy)
18e83cf Only return the tx hex string in rawdelegatestake (Fuzzbawls)
85d83b1 Further RPC help output cleanups (Fuzzbawls)
2c315a3 Only Return the transaction hex string in `rawshieldsendmany` (Fuzzbawls)
a6b3f77 [BUG][GUI] Cache unconfirmed_balance only for transparent outs (random-zebra)
d95f0ca [BUG][GUI] Don't return StakingOnlyUnlocked from WalletModel::sendCoins (random-zebra)
f17aabc [Trivial][GUI] coin control: Fixed column size in list-mode (random-zebra)
f3662f8 [GUI] Finally, fix duplicate records. (furszy)
1d95c40 [DOC] main readme, added latest release version and release date badges (furszy)
afcba75 [DOC] main readme, re-written to current project state. (furszy)
7fd9e62 [DOC] Readme, migrated staled travis badge for github actions status badge. (furszy)
227161b [Trivial][RPC] Drop 'ed' suffix from Shielded in TxSaplingToJSON (random-zebra)
ed8999a [GUI] send screen, hide shield all coins btn for now. (furszy)

Pull request description:

  further backports for the 5.0 branch:

  #2094
  #2093
  #2095
  #2096
  #2098
  #2104
  #2102
  #2097
  #2103
  #2101
  #2108
  #2109

ACKs for top commit:
  furszy:
    utACK 41abf5a
  random-zebra:
    utACK 41abf5a and merging...

Tree-SHA512: 34619594f6e87362f8760a24c39ef25e8acf856de258d1e40f5a1264381fb9e6f6210bcca2b1bc765a0366c7a4467d43c95147bf75f7c2d64d16ee3b41a9efb9
@random-zebra random-zebra removed the Needs Backport Placeholder tag for anything needing a backport to prior version branches label Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Block Generation Mining/Staking related issues Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants