コード例 #1
0
ファイル: core.py プロジェクト: vrde/bigchaindb
    def info(self, request):
        """Return height of the latest committed block."""

        self.abort_if_abci_chain_is_not_synced()

        r = ResponseInfo()
        block = self.bigchaindb.get_latest_block()
        if block:
            chain_shift = 0 if self.chain is None else self.chain['height']
            r.last_block_height = block['height'] - chain_shift
            r.last_block_app_hash = block['app_hash'].encode('utf-8')
        else:
            r.last_block_height = 0
            r.last_block_app_hash = b''
        return r
コード例 #2
0
 def info(self, req):
     v = req.version
     r = ResponseInfo(version=v,
                      data="hello",
                      last_block_height=0,
                      last_block_app_hash=b'0x12')
     return r
コード例 #3
0
ファイル: core.py プロジェクト: oscar810429/bigchaindb
    def info(self, request):
        """Return height of the latest committed block."""

        self.abort_if_abci_chain_is_not_synced()

        # Check if BigchainDB supports the Tendermint version
        if not (hasattr(request, 'version')
                and tendermint_version_is_compatible(request.version)):
            logger.error(
                f'Unsupported Tendermint version: {getattr(request, "version", "no version")}.'
                f' Currently, BigchainDB only supports {__tm_supported_versions__}. Exiting!'
            )
            sys.exit(1)

        logger.info(f"Tendermint version: {request.version}")

        r = ResponseInfo()
        block = self.bigchaindb.get_latest_block()
        if block:
            chain_shift = 0 if self.chain is None else self.chain['height']
            r.last_block_height = block['height'] - chain_shift
            r.last_block_app_hash = block['app_hash'].encode('utf-8')
        else:
            r.last_block_height = 0
            r.last_block_app_hash = b''
        return r
コード例 #4
0
ファイル: core.py プロジェクト: roderik/bigchaindb
    def info(self, request):
        """Return height of the latest committed block."""

        self.abort_if_abci_chain_is_not_synced()

        # Check if BigchainDB supports the Tendermint version
        if not (hasattr(request, 'version') and tendermint_version_is_compatible(request.version)):
            logger.error(f'Unsupported Tendermint version: {getattr(request, "version", "no version")}.'
                         f' Currently, BigchainDB only supports {__tm_supported_versions__}. Exiting!')
            sys.exit(1)

        logger.info(f"Tendermint version: {request.version}")

        r = ResponseInfo()
        block = self.bigchaindb.get_latest_block()
        if block:
            chain_shift = 0 if self.chain is None else self.chain['height']
            r.last_block_height = block['height'] - chain_shift
            r.last_block_app_hash = block['app_hash'].encode('utf-8')
        else:
            r.last_block_height = 0
            r.last_block_app_hash = b''
        return r
コード例 #5
0
 def info(self, request):
     """Return height of the latest committed block."""
     r = ResponseInfo()
     block = self.bigchaindb.get_latest_block()
     if block:
         r.last_block_height = block['height']
         r.last_block_app_hash = block['app_hash'].encode('utf-8')
     else:
         r.last_block_height = 0
         r.last_block_app_hash = b''
     return r
コード例 #6
0
ファイル: core.py プロジェクト: vaboss/bigchaindb
    def info(self, request):
        """Return height of the latest committed block."""

        self.abort_if_abci_chain_is_not_synced()

        r = ResponseInfo()
        block = self.bigchaindb.get_latest_block()
        if block:
            chain_shift = 0 if self.chain is None else self.chain['height']
            r.last_block_height = block['height'] - chain_shift
            r.last_block_app_hash = block['app_hash'].encode('utf-8')
        else:
            r.last_block_height = 0
            r.last_block_app_hash = b''
        return r