lib/runBlockchain.js
function getStartingState (cb) {
      // if we are just starting or if a chain re-org has happened
      if (!headBlock || reorg) {
        blockchain.getBlock(block.header.parentHash, function (err, parentBlock) {
          parentState = parentBlock.header.stateRoot
          // generate genesis state if we are at the genesis block
          // we don't have the genesis state
          if (!headBlock) {
            return self.stateManager.generateCanonicalGenesis(cb)
          } else {
            cb(err)
          }
        })
      } else {
        parentState = headBlock.header.stateRoot
        cb()
      }
    }
function getStartingState (cb) {
      // if we are just starting or if a chain re-org has happened
      if (!headBlock || reorg) {
        blockchain.getBlock(block.header.parentHash, function (err, parentBlock) {
          parentState = parentBlock.header.stateRoot
          // generate genesis state if we are at the genesis block
          // we don't have the genesis state
          if (!headBlock) {
            return self.stateManager.generateCanonicalGenesis(cb)
          } else {
            cb(err)
          }
        })
      } else {
        parentState = headBlock.header.stateRoot
        cb()
      }
    }
function getStartingState ( cb ) { // if we are just starting or if a chain re-org has happened if ( ! headBlock || reorg ) { blockchain . getBlock ( block . header . parentHash , function ( err , parentBlock ) { parentState = parentBlock . header . stateRoot // generate genesis state if we are at the genesis block // we don't have the genesis state if ( ! headBlock ) { return self . stateManager . generateCanonicalGenesis ( cb ) } else { cb ( err ) } } ) } else { parentState = headBlock . header . stateRoot cb ( ) } }
determine starting state for block run
determine starting state for block run