RunOnFlux / fluxd

Flux Daemon
https://runonflux.io
MIT License
78 stars 43 forks source link

Add fluxnodecount index flag #239

Open blondfrogs opened 5 months ago

blondfrogs commented 5 months ago

This PR adds a new index flag fluxnodecount.

This flag will require a reindex to take place as it modifies the CBlockIndex to include the number of confirmed nodes in each tier at each block height.

If this is enabled, you can call getfluxnodecount with additional paramters. History starts at block 558000 - When deterministic fluxnodes went live

I suggest putting the output to a file ">> history.json" as the data size is pretty large when using smaller numbers

getfluxnodecount true >> history.json - this will return all fluxnode counts from start every 360 blocks or ~12 hours. getfluxnodecount true 720 >> history.json - this will return all fluxnode counts from start every 720 blocks or ~1 day. getfluxnodecount true 1 >> history.json - this will return all fluxnode counts from start every block.

For example

getfluxnodecount true 250000 returns


  "558000": {
    "stratus": 0,
    "nimbus": 0,
    "cumulus": 0
  },
  "808000": {
    "stratus": 218,
    "nimbus": 297,
    "cumulus": 180
  },
  "1058000": {
    "stratus": 543,
    "nimbus": 877,
    "cumulus": 1244
  },
  "1308000": {
    "stratus": 2112,
    "nimbus": 2435,
    "cumulus": 10898
  },
  "1558000": {
    "stratus": 1770,
    "nimbus": 2005,
    "cumulus": 8359
  }
}`