def mine_on_chain(chain, parent=None, transactions=[], coinbase=None):
 if (not parent):
  parent = chain.head
 if coinbase:
  chain.coinbase = coinbase
 chain._update_head(parent)
 for t in transactions:
  chain.add_transactions(t)
 assert (chain.head_candidate.difficulty == 1)
 m = ethpow.Miner(chain.head_candidate)
 rounds = 100
 nonce = 0
 while True:
  b = m.mine(rounds=rounds, start_nonce=nonce)
  if b:
   break
  nonce += rounds
 assert b.header.check_pow()
 chain.add_block(b)
 return b

def mine_on_chain ( chain , parent = None , transactions = [ ] , coinbase = None ) : if ( not parent ) : parent = chain . head if coinbase : chain . coinbase = coinbase chain . _update_head ( parent ) for t in transactions : chain . add_transactions ( t ) assert ( chain . head_candidate . difficulty == 1 ) m = ethpow . Miner ( chain . head_candidate ) rounds = 100 nonce = 0 while True : b = m . mine ( rounds = rounds , start_nonce = nonce ) if b : break nonce += rounds assert b . header . check_pow ( ) chain . add_block ( b ) return b
mine the next block on a chain .