Return the consensus hash at a block number.
        Return {'status': True, 'consensus': ...} on success
        Return {'error': ...} on error
779577
def rpc_get_consensus_at( self, block_id, **con_info ):
        
        if not check_block(block_id):
            return {'error': 'Invalid block height', 'http_status': 400}

        db = get_db_state(self.working_dir)
        consensus = db.get_consensus_at( block_id )
        db.close()
        return self.success_response( {'consensus': consensus} )
445114
def eth_getBlockByNumber(self, number):
        
        block_hash = self.reader._get_block_hash(number)
        block_number = _format_block_number(number)
        body_key = body_prefix + block_number + block_hash
        block_data = self.db.get(body_key)
        body = rlp.decode(block_data, sedes=Block)
        return body
1126427
def get_current_block_hash(self, is_full: bool = False) -> str:
        
        payload = self.generate_json_rpc_payload(RpcMethod.GET_CURRENT_BLOCK_HASH)
        response = self.__post(self.__url, payload)
        if is_full:
            return response
        return response['result']
97760
def at_block_number(block_number: BlockNumber, chain: MiningChain) -> MiningChain:
    
    if not isinstance(chain, MiningChain):
        raise ValidationError("`at_block_number` may only be used with 'MiningChain")
    at_block = chain.get_canonical_block_by_number(block_number)

    db = chain.chaindb.db
    chain_at_block = type(chain)(db, chain.create_header_from_parent(at_block.header))
    return chain_at_block
505800
def status(self):
        
        orig_dict = self._get(self._service_url('status'))
        orig_dict['implementation_version'] = orig_dict.pop('Implementation-Version')
        orig_dict['built_from_git_sha1'] = orig_dict.pop('Built-From-Git-SHA1')
        return Status(orig_dict)
105557
def get_block_by_number(self, block_number, full_transactions=True):
        
        if isinstance(block_number, numbers.Number):
            block_number_as_hex = hex(block_number)
        else:
            block_number_as_hex = block_number
        response = self.make_request(
            "eth_getBlockByNumber", [block_number_as_hex, full_transactions],
        )
        return response['result']
900258
def get_block_statistics(cls, block_id):
        
        if not os.environ.get("BLOCKSTACK_TEST"):
            raise Exception("This method is only available in the test framework")

        global STATISTICS
        return STATISTICS.get(block_id)
1298895
def eth_getBlockTransactionCountByHash(self, bhash):
        
        response = yield from self.rpc_call('eth_getBlockTransactionCountByHash',
                                            [bhash])
        if response:
            return hex_to_dec(response)
        return response
1135672
def get_sha(self) -> str:
        
        current_sha: str = self.repo.head.commit.hexsha
        LOGGER.debug('current commit SHA: %s', current_sha)
        return current_sha
979161
def get_consensus(block):
    """"""
    from collections import Counter

    # Take aligned (non-insert) chars from all rows; transpose
    columns = zip(*[[c for c in row['seq'] if not c.islower()]
                    for row in block['sequences']])
    cons_chars = [Counter(col).most_common()[0][0] for col in columns]
    cons_chars = [c if c != '-' else 'X' for c in cons_chars]
    assert len(cons_chars) == block['query_length']
    cons_sequence = {
        'index': 1,
        'id': 'consensus',
        'description': '',
        'dbxrefs': {},
        'phylum': '',
        'taxchar': '',
        'head_len': None,
        'tail_len': None,
        'head_seq': '',
        'tail_seq': '',
        'length': block['query_length'],
        'seq': ''.join(cons_chars),
    }
    return cons_sequence
404909
def get_block_count(self, is_full: bool = False) -> int or dict:
        
        payload = self.generate_json_rpc_payload(RpcMethod.GET_BLOCK_COUNT)
        response = self.__post(self.__url, payload)
        if is_full:
            return response
        return response['result']
234265
def get_block_statuses(self, block_ids):
        
        try:
            return [
                (block_id.hex(),
                 self._chain_controller.block_validation_result(
                     block_id.hex()))
                for block_id in block_ids
            ]
        except KeyError as key_error:
            raise UnknownBlock(key_error.args[0])
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')
445861
def get_canonical_block_hash(self, block_number: BlockNumber) -> Hash32:
        
        return self._get_canonical_block_hash(self.db, block_number)
863216
def get_block(self, block_identifier: BlockSpecification) -> Dict:
        """"""
        return self.web3.eth.getBlock(block_identifier)
949601
def eth_getBlockByNumber(self, block=BLOCK_TAG_LATEST, tx_objects=True):
        
        block = validate_block(block)
        return self._call("eth_getBlockByNumber", [block, tx_objects])
1164732
def rpc_get_blockstack_ops_hash_at( self, block_id, **con_info ):
        
        if not check_block(block_id):
            return {'error': 'Invalid block height', 'http_status': 400}

        db = get_db_state(self.working_dir)
        ops_hash = db.get_block_ops_hash( block_id )
        db.close()

        return self.success_response( {'ops_hash': ops_hash} )