function payOmmersAndMiner (cb) {
    var ommers = block.uncleHeaders

    // pay each ommer
    async.series([
      rewardOmmers,
      rewardMiner
    ], cb)

    function rewardOmmers (done) {
      async.each(block.uncleHeaders, function (ommer, next) {
        // calculate reward
        var minerReward = new BN(self._common.param('pow', 'minerReward'))
        var heightDiff = new BN(block.header.number).sub(new BN(ommer.number))
        var reward = ((new BN(8)).sub(heightDiff)).mul(minerReward.divn(8))

        if (reward.ltn(0)) {
          reward = new BN(0)
        }

        rewardAccount(ommer.coinbase, reward, next)
      }, done)
    }

    function rewardMiner (done) {
      // calculate nibling reward
      var minerReward = new BN(self._common.param('pow', 'minerReward'))
      var niblingReward = minerReward.divn(32)
      var totalNiblingReward = niblingReward.muln(ommers.length)
      var reward = minerReward.add(totalNiblingReward)
      rewardAccount(block.header.coinbase, reward, done)
    }

    function rewardAccount (address, reward, done) {
      self.stateManager.getAccount(address, function (err, account) {
        if (err) return done(err)
        // give miner the block reward
        account.balance = new BN(account.balance).add(reward)
        self.stateManager.putAccount(address, account, done)
      })
    }
  }
function payOmmersAndMiner (cb) {
    var ommers = block.uncleHeaders

    
    async.series([
      rewardOmmers,
      rewardMiner
    ], cb)

    function rewardOmmers (done) {
      async.each(block.uncleHeaders, function (ommer, next) {
        
        var minerReward = new BN(self._common.param('pow', 'minerReward'))
        var heightDiff = new BN(block.header.number).sub(new BN(ommer.number))
        var reward = ((new BN(8)).sub(heightDiff)).mul(minerReward.divn(8))

        if (reward.ltn(0)) {
          reward = new BN(0)
        }

        rewardAccount(ommer.coinbase, reward, next)
      }, done)
    }

    function rewardMiner (done) {
      
      var minerReward = new BN(self._common.param('pow', 'minerReward'))
      var niblingReward = minerReward.divn(32)
      var totalNiblingReward = niblingReward.muln(ommers.length)
      var reward = minerReward.add(totalNiblingReward)
      rewardAccount(block.header.coinbase, reward, done)
    }

    function rewardAccount (address, reward, done) {
      self.stateManager.getAccount(address, function (err, account) {
        if (err) return done(err)
        
        account.balance = new BN(account.balance).add(reward)
        self.stateManager.putAccount(address, account, done)
      })
    }
  }
function payOmmersAndMiner ( cb ) { var ommers = block . uncleHeaders // pay each ommer async . series ( [ rewardOmmers , rewardMiner ] , cb ) function rewardOmmers ( done ) { async . each ( block . uncleHeaders , function ( ommer , next ) { // calculate reward var minerReward = new BN ( self . _common . param ( 'pow' , 'minerReward' ) ) var heightDiff = new BN ( block . header . number ) . sub ( new BN ( ommer . number ) ) var reward = ( ( new BN ( 8 ) ) . sub ( heightDiff ) ) . mul ( minerReward . divn ( 8 ) ) if ( reward . ltn ( 0 ) ) { reward = new BN ( 0 ) } rewardAccount ( ommer . coinbase , reward , next ) } , done ) } function rewardMiner ( done ) { // calculate nibling reward var minerReward = new BN ( self . _common . param ( 'pow' , 'minerReward' ) ) var niblingReward = minerReward . divn ( 32 ) var totalNiblingReward = niblingReward . muln ( ommers . length ) var reward = minerReward . add ( totalNiblingReward ) rewardAccount ( block . header . coinbase , reward , done ) } function rewardAccount ( address , reward , done ) { self . stateManager . getAccount ( address , function ( err , account ) { if ( err ) return done ( err ) // give miner the block reward account . balance = new BN ( account . balance ) . add ( reward ) self . stateManager . putAccount ( address , account , done ) } ) } }
credit all block rewards
credit all block rewards