return this block height. block height is included in coinbase.
 if block version under 1, height does not include in coinbase, so return nil.
433804
def height
      return nil if header.version < 2
      coinbase_tx = transactions[0]
      return nil unless coinbase_tx.coinbase_tx?
      buf = StringIO.new(coinbase_tx.inputs[0].script_sig.to_payload)
      len = Bitcoin.unpack_var_int_from_io(buf)
      buf.read(len).reverse.bth.to_i(16)
    end
887704
def layer_height(self, layer_int):
        
        if layer_int == self.n_layers:
            if self.height is None:
                return None
            return self.height - self.layer_depth(layer_int)
        else:
            return self.layer_depth(layer_int + 1) - self.layer_depth(layer_int)
905748
private void checkTransactions(final int height, final EnumSet<VerifyFlag> flags)
            throws VerificationException {
        // The first transaction in a block must always be a coinbase transaction.
        if (!transactions.get(0).isCoinBase())
            throw new VerificationException("First tx is not coinbase");
        if (flags.contains(Block.VerifyFlag.HEIGHT_IN_COINBASE) && height >= BLOCK_HEIGHT_GENESIS) {
            transactions.get(0).checkCoinBaseHeight(height);
        }
        // The rest must not be.
        for (int i = 1; i < transactions.size(); i++) {
            if (transactions.get(i).isCoinBase())
                throw new VerificationException("TX " + i + " is coinbase when it should not be.");
        }
    }
129423
def height(self, height=None):
        """"""

        if height is None:
            return self._height
        else:
            if not is_numeric(height):
                raise TypeError("height must be numeric, not '%s'" % str(height))
            self._height = height
977322
def GET_account_at(self, path_info, account_addr, block_height):
        
        if not check_account_address(account_addr):
            return self._reply_json({'error': 'Invalid address'}, status_code=400)

        try:
            block_height = int(block_height)
            assert check_block(block_height)
        except:
            return self._reply_json({'error': 'Invalid block height'}, status_code=400)

        blockstackd_url = get_blockstackd_url()
        res = blockstackd_client.get_account_at(account_addr, block_height, hostport=blockstackd_url)
        if json_is_error(res):
            log.error("Failed to list account history for {} at {}: {}".format(account_addr, block_height, res['error']))
            return self._reply_json({'error': 'Failed to get account state for {} at {}'.format(account_addr, block_height)}, status_code=res.get('http_status', 500))

        self._reply_json(res)
        return
755753
def get_validator_change(cls, bigchain):
        
        latest_block = bigchain.get_latest_block()
        if latest_block is None:
            return None
        return bigchain.get_validator_change(latest_block['height'])
520025
def get_block_by_height(self, height: int, is_full: bool = False) -> dict:
        
        payload = self.generate_json_rpc_payload(RpcMethod.GET_BLOCK, [height, 1])
        response = self.__post(self.__url, payload)
        if is_full:
            return response
        return response['result']
429302
def _getBlock(self, block_spec):
        
        if block_spec is None:
            return
        if all(c in string.hexdigits for c in block_spec):
            block_spec = block_spec.upper()
            ix = 0
        else:
            ix = 2
        for block in all_blocks:
            if block[ix] == block_spec:
                return block
        raise ValueError('No such block')
873184
func (b *BtcWallet) GetBlockHash(blockHeight int64) (*chainhash.Hash, error) {
	return b.chain.GetBlockHash(blockHeight)
}
1162673
def BlockheightCheck(self):
        
        if self.CurrentBlockheight == BC.Default().Height:
            if len(self.Peers) > 0:
                logger.debug("Blockheight is not advancing ...")
                next_hash = BC.Default().GetHeaderHash(self.CurrentBlockheight + 1)
                culprit_found = False
                for peer in self.Peers:
                    if next_hash in peer.myblockrequests:
                        culprit_found = True
                        peer.Disconnect()
                        break

                # this happens when we're connecting to other nodes that are stuck themselves
                if not culprit_found:
                    for peer in self.Peers:
                        peer.Disconnect()
        else:
            self.CurrentBlockheight = BC.Default().Height
1145490
def _get_block(self):
    """"""
    b = self._fh.read(4) # get block size bytes
    #print self._fh.tell()
    if not b: raise StopIteration
    block_size = struct.unpack('<i',b)[0]
    return self._fh.read(block_size)
196579
@Override
	public int getMinPrefixLengthForBlock() {
		int count = getDivisionCount();
		int totalPrefix = getBitCount();
		for(int i = count - 1; i >= 0 ; i--) {
			AddressDivisionBase div = getDivision(i);
			int segBitCount = div.getBitCount();
			int segPrefix = div.getMinPrefixLengthForBlock();
			if(segPrefix == segBitCount) {
				break;
			} else {
				totalPrefix -= segBitCount;
				if(segPrefix != 0) {
					totalPrefix += segPrefix;
					break;
				}
			}
		}
		return totalPrefix;
	}
1258385
function( level ) {

        if(this.emulateLegacyImagePyramid) {
            return $.TileSource.prototype.getTileHeight.call(this, level);
        }

        var scaleFactor = Math.pow(2, this.maxLevel - level);

        if (this.tileSizePerScaleFactor && this.tileSizePerScaleFactor[scaleFactor]) {
            return this.tileSizePerScaleFactor[scaleFactor].height;
        }
        return this._tileHeight;
    }
1269551
def get_canonical_block_header_by_number(self, block_number: BlockNumber) -> BlockHeader:
        
        return self._get_canonical_block_header_by_number(self.db, block_number)
16931
def db_chainstate_get_block(cls, cur, block_height):
        
        query = 'SELECT * FROM chainstate WHERE block_id = ? ORDER BY vtxindex;'
        args = (block_height,)

        rows = cls.db_query_execute(cur, query, args, verbose=False)
        ret = []

        for r in rows:
            rowdata = {
                'txid': str(r['txid']),
                'block_id': r['block_id'],
                'txindex': r['txindex'],
                'vtxindex': r['vtxindex'],
                'opcode': str(r['opcode']),
                'data_hex': str(r['data_hex']),
                'senders': simplejson.loads(r['senders']),
                'tx_hex': str(r['tx_hex']),
                'tx_merkle_path': str(r['tx_merkle_path']),
                'fee': r['fee']
            }

            ret.append(rowdata)

        return ret
1090655
func ExtractCoinbaseHeight(coinbaseTx *btcutil.Tx) (int32, error) {
	sigScript := coinbaseTx.MsgTx().TxIn[0].SignatureScript
	if len(sigScript) < 1 {
		str := "the coinbase signature script for blocks of " +
			"version %d or greater must start with the " +
			"length of the serialized block height"
		str = fmt.Sprintf(str, serializedHeightVersion)
		return 0, ruleError(ErrMissingCoinbaseHeight, str)
	}

	// Detect the case when the block height is a small integer encoded with
	// as single byte.
	opcode := int(sigScript[0])
	if opcode == txscript.OP_0 {
		return 0, nil
	}
	if opcode >= txscript.OP_1 && opcode <= txscript.OP_16 {
		return int32(opcode - (txscript.OP_1 - 1)), nil
	}

	// Otherwise, the opcode is the length of the following bytes which
	// encode in the block height.
	serializedLen := int(sigScript[0])
	if len(sigScript[1:]) < serializedLen {
		str := "the coinbase signature script for blocks of " +
			"version %d or greater must start with the " +
			"serialized block height"
		str = fmt.Sprintf(str, serializedLen)
		return 0, ruleError(ErrMissingCoinbaseHeight, str)
	}

	serializedHeightBytes := make([]byte, 8)
	copy(serializedHeightBytes, sigScript[1:serializedLen+1])
	serializedHeight := binary.LittleEndian.Uint64(serializedHeightBytes)

	return int32(serializedHeight), nil
}
1184541
public function getHeight() : ?int 
    {
        if ( ! $this->hasHeight()) {
            $this->setHeight($this->getDefaultHeight());
        }
        return $this->height;
    }