Skip to content

Prevent crashes due to missing or corrupted database records - #1381

Merged
jgarzik merged 2 commits into
bitcoin:masterfrom
jgarzik:check-deser
May 22, 2012
Merged

jgarzik merged 2 commits into
bitcoin:masterfrom
jgarzik:check-deser

Conversation

@jgarzik

@jgarzik jgarzik commented May 22, 2012

Copy link
Copy Markdown
Contributor

Any problems seen during deserialization will throw an uncaught
exception, crashing the entire bitcoin process. Properly return an
error instead, so that we may at least log the error and gracefully
shutdown other portions of the app.

@gavinandresen

Copy link
Copy Markdown
Contributor

ACK, long overdue. Compiled and ran on my Mac.

Jeff Garzik added 2 commits May 22, 2012 15:12
Any problems seen during deserialization will throw an uncaught
exception, crashing the entire bitcoin process.  Properly return an
error instead, so that we may at least log the error and gracefully
shutdown other portions of the app.
In LoadExternalBlockFile(), errors are already caught... silently.
Add a warning message, even though we do not abort the program due to
load error.
@jgarzik

jgarzik commented May 22, 2012

Copy link
Copy Markdown
Contributor Author

Added new commit, catching deser exceptions for CAutoFile (blknnnn.dat) too.

jgarzik pushed a commit that referenced this pull request May 22, 2012
Prevent crashes due to missing or corrupted database records
@jgarzik
jgarzik merged commit 5d0f7c4 into bitcoin:master May 22, 2012
coblee pushed a commit to litecoin-project/litecoin that referenced this pull request Jul 17, 2012
Prevent crashes due to missing or corrupted database records
@jgarzik
jgarzik deleted the check-deser branch August 24, 2014 04:19
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request Jan 22, 2019
Implement little endian ascending transaction ordering (CTOR)
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request May 6, 2020
…ner, not rank-1 mn

83e01fa [RPC][Bug] Fix masternodecurrent: return next winner, not rank-1 mn (random-zebra)

Pull request description:

  `masternodecurrent` RPC is improperly returning the masternode with rank 1 instead of the next winner.
  Closes bitcoin#1348

  ```
  > getblockcount
  2236241

  > masternodecurrent
  {
    "protocol": 70918,
    "txhash": "cfa69f018741e0960a436788391d9d2cec0f9aceed30e883a78818f7c073fba1",
    "pubkey": "DHeEycDFe9pWr3FahcnTbavy8Urb1832HU",
    "lastseen": 1583439177,
    "activeseconds": 6690804
  }

  > getmasternodewinners 0
  [
    {
      "nHeight": 2236242,
      "winner": {
        "address": "DHeEycDFe9pWr3FahcnTbavy8Urb1832HU",
        "nVotes": 10
      }
    },
    ...
  ]
  ```
  <https://explorer.pivx.link/block/9fe33eedf5f61a8e9f8d50b9007c25d1b0260f0c97f88265feda4c06dfa86725>

  Note: `GetCurrentMasterNode` returns the masternode with lower rank and it's used as winner only when no valid block payee can be found. We should probably change its name to something more meaningful (`GetLowestRankMasterNode` ?) and change the comment calling it "winner". Same goes for the comment above `CMasternode::CalculateScore` (masternodes are not even paid based on their scores, but only on the time of their last payment).

ACKs for top commit:
  furszy:
    utACK 83e01fa
  Fuzzbawls:
    ACK 83e01fa

Tree-SHA512: c6bd9b5c83900a4e269b6dd308ea083bc0d4a778ebbf1c865019d092cba9b024819d97f792d9fd34040f36034d507eda482da398a34915e9497db3bf1b70d9b3
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants