code: func (b *BlockGen) AddTxWithChain(bc *BlockChain, tx *types.Transaction) {
  	if b.gasPool == nil {
  		b.SetCoinbase(common.Address{})
  	}
  	b.statedb.Prepare(tx.Hash(), common.Hash{}, len(b.txs))
  	receipt, _, err := ApplyTransaction(b.config, bc, &b.header.Coinbase, b.gasPool, b.statedb, b.header, tx, &b.header.GasUsed, vm.Config{})
  	if err != nil {
  		panic(err)
  	}
  	b.txs = append(b.txs, tx)
  	b.receipts = append(b.receipts, receipt)
  }
docs: // AddTxWithChain adds a transaction to the generated block. If no coinbase has
  // been set, the block's coinbase is set to the zero address.
  //
  // AddTxWithChain panics if the transaction cannot be executed. In addition to
  // the protocol-imposed limitations (gas limit, etc.), there are some
  // further limitations on the content of transactions that can be
  // added. If contract code relies on the BLOCKHASH instruction,
  // the block in chain will be returned.