lib/runBlockchain.js
function runBlock (cb) {
      self.runBlock({
        block: block,
        root: parentState
      }, function (err, results) {
        if (err) {
          // remove invalid block
          blockchain.delBlock(block.header.hash(), function () {
            cb(err)
          })
        } else {
          // set as new head block
          headBlock = block
          cb()
        }
      })
    }
function runBlock (cb) {
      self.runBlock({
        block: block,
        root: parentState
      }, function (err, results) {
        if (err) {
          // remove invalid block
          blockchain.delBlock(block.header.hash(), function () {
            cb(err)
          })
        } else {
          // set as new head block
          headBlock = block
          cb()
        }
      })
    }
function runBlock ( cb ) { self . runBlock ( { block : block , root : parentState } , function ( err , results ) { if ( err ) { // remove invalid block blockchain . delBlock ( block . header . hash ( ) , function ( ) { cb ( err ) } ) } else { // set as new head block headBlock = block cb ( ) } } ) }
run block, update head if valid
run block update head if valid