Skip to content

Conversation

@random-zebra
Copy link

@random-zebra random-zebra commented Oct 11, 2019

Fix a few inconsistencies with GetDepthInMainChain returning 0 where a value -1 was expected (for orphans) and a bug where nodes may relay coinstake transactions.

@random-zebra random-zebra added this to the 4.0.0 milestone Oct 11, 2019
@random-zebra random-zebra self-assigned this Oct 11, 2019
@random-zebra random-zebra force-pushed the 2019_bug_coinstakes_mempool branch from 80374cd to 2d04b22 Compare October 11, 2019 19:41
@random-zebra random-zebra changed the title [Bug] coinstakes should not be considered in RelayWalletTransaction [Bug] Fix GetDepthInMainChain returning 0 when tx is not in mempool Oct 11, 2019
@random-zebra random-zebra force-pushed the 2019_bug_coinstakes_mempool branch 6 times, most recently from 9b995d2 to 8555df6 Compare October 11, 2019 23:47
@random-zebra random-zebra force-pushed the 2019_bug_coinstakes_mempool branch from 8555df6 to 29641e3 Compare October 12, 2019 00:01
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 29641e3

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.

utACK 29641e3

random-zebra added a commit that referenced this pull request Oct 12, 2019
… in mempool

29641e3 [Wallet] Fix inconsistencies with GetDepthInMainChain (random-zebra)

Pull request description:

  Fix a few inconsistencies with `GetDepthInMainChain` returning 0 where a value -1 was expected (for orphans) and a bug where nodes may relay coinstake transactions.

ACKs for top commit:
  Fuzzbawls:
    utACK 29641e3
  furszy:
    utACK 29641e3

Tree-SHA512: db57b7e9dfd837932b09eae1697ce53e45c3da859ae15cde52234eafe826f15f8bdb75aadb9150fc19ed34a9a5b86cf68d1d26874b488d8d2e13a2300f3e35cb
@random-zebra random-zebra merged commit 29641e3 into PIVX-Project:master Oct 12, 2019
random-zebra added a commit that referenced this pull request Oct 18, 2019
…uts to the wallet

3a7ec7c [Tests] Add wallet_reorg-stake functional test to test_runner.py (random-zebra)
a0285e4 [Wallet] Fix bug with coinstake inputs wrongly marked as spent (random-zebra)
bb683c7 [Tests] Add wallet_reorg-stake functional test (random-zebra)
3eca8da [Core][Tests] REGTEST: fix nStakeModifier=0 (random-zebra)

Pull request description:

  Additional bug introduced with the changes of #970 (and not caught in #1040 even though the culprit is the same: `GetDepthInMainChain` returning a value `0` when `-1` was expected).

  After a block reorganization, the coins used as coinstake inputs in the orphan chain were still marked as spent in the wallet. Thus there were inconsistencies in the balance (either displayed in the GUI or returned by `getbalance` via CLI) and missing utxos in the wallet (either accessed through coincontrol in the GUI or returned by `listunspent` via CLI).

  a0285e4 fixes it by marking as "spent" the inputs of not-in-mempool txes only for non-coinstakes (coinstakes don't hit the mempool so, when not in chain, their inputs should be considered unspent).

  bb683c7 Introduces the functional test `wallet_reorg-stake` to reproduce the issue.
  The test fails without a0285e4 and passes with it.

ACKs for top commit:
  Warrows:
    ACK 3a7ec7c

Tree-SHA512: 8f97e3d48720b776c84820e0ab8257665ac4c4c9d394db0e4b9f3a05b0904bf9f70cf54865338c4e29066e6b3670e9e90f77780d3ddd198e8e2b6e416c4cb49c
@random-zebra random-zebra deleted the 2019_bug_coinstakes_mempool branch September 24, 2020 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants