lbryio / lbcd

An alternative full node implementation of LBRY's blockchain written in Go (golang)
https://lbry.com/
ISC License
38 stars 25 forks source link

Bring `getblockchaininfo` up to date #54

Open roylee17 opened 2 years ago

roylee17 commented 2 years ago

Bring getblockchaininfo up to date (v0.23)

On lbcd:

{
  "chain": "mainnet",
  "blocks": 1174511,
  "headers": 1174511,
  "bestblockhash": "bb9a8030f84f710b88a91521e80289facb4924eb24e08702757e1294997452c6",
  "difficulty": 1369713051994.9846,
  "mediantime": 1654923545,
  "pruned": false,
  "bip9_softforks": {
    "csv": {
      "status": "active",
      "bit": 0,
      "startTime": 0,
      "start_time": 1462060800,
      "timeout": 1493596800,
      "since": 200000
    },
    "dummy": {
      "status": "failed",
      "bit": 28,
      "startTime": 0,
      "start_time": 1199145601,
      "timeout": 1230767999,
      "since": 0
    },
    "segwit": {
      "status": "active",
      "bit": 1,
      "startTime": 0,
      "start_time": 1547942400,
      "timeout": 1548288000,
      "since": 680770
    },
    "taproot": {
      "status": "failed",
      "bit": 0,
      "startTime": 0,
      "start_time": 0,
      "timeout": 0,
      "since": 0
    }
  }
}

On lbrycrd (0.17 based):

{
  "chain": "lbrycrd",
  "blocks": 1174511,
  "headers": 1174511,
  "bestblockhash": "bb9a8030f84f710b88a91521e80289facb4924eb24e08702757e1294997452c6",
  "difficulty": 1369713051994.985,
  "mediantime": 1654923545,
  "verificationprogress": 0.999194946520285,
  "initialblockdownload": false,
  "chainwork": "000000000000000000000000000000000000000000000970cda1e06046741a5e",
  "size_on_disk": 90879066566,
  "pruned": false,
  "softforks": [
    {
      "id": "bip34",
      "version": 2,
      "reject": {
        "status": true
      }
    },
    {
      "id": "bip66",
      "version": 3,
      "reject": {
        "status": true
      }
    },
    {
      "id": "bip65",
      "version": 4,
      "reject": {
        "status": true
      }
    }
  ],
  "bip9_softforks": {
    "csv": {
      "status": "active",
      "startTime": 1462060800,
      "timeout": 1493596800,
      "since": 6048
    },
    "segwit": {
      "status": "active",
      "startTime": 1547942400,
      "timeout": 1548288000,
      "since": 508032
    }
  },
  "warnings": ""
}
moodyjon commented 2 years ago

I suspect at least part of the problem is lies here: https://github.com/lbryio/lbcd/blob/6b0e7592c6e136611caae04831a36db432cc1c39/rpcclient/chain.go#L488

There was a catch-all "Lbcd" version added at some point, and it doesn't count as "Post19". So "Lbcd" falls into the default case (not displaying softforks).

roylee17 commented 2 years ago

Looks like it should unmarshal both fields instead for post19 instead of only one of them.