예제 #1
0
    def info(self):
        """Called by ABCI when the app first starts."""

        self.conf = utils.read_conf()
        self.db = utils.DatabaseProvider(conf=self.conf)

        r = ResponseInfo()
        r.last_block_height = self.db.get_block_height()
        r.last_block_app_hash = self.db.get_block_app_hash().encode()
        return r
예제 #2
0
 def info(self, req) -> ResponseInfo:
     """
     Since this will always respond with height=0, Tendermint
     will resync this app from the begining
     """
     r = ResponseInfo()
     r.version = "1.0"
     r.last_block_height = 0
     r.last_block_app_hash = b''
     return r
예제 #3
0
 def info(self):
     r = ResponseInfo()
     r.data = "counter"
     r.version = "1.0"
     r.last_block_height = 0
     r.last_block_app_hash = b''
     return r
예제 #4
0
    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, req):
        # Load state
        if not self._storage:
            state, _ = setup_app_state(self.rootdir)
            self._storage = Storage(state)

        result = ResponseInfo()
        result.last_block_height = self._storage.state.last_block_height
        result.last_block_app_hash = self._storage.state.last_block_hash
        result.data = "pyTendermint app v{}".format(self.version)
        result.version = self.version
        return result
예제 #6
0
 def info(self):
     r = ResponseInfo()
     r.last_block_height = 0
     r.last_block_app_hash = b''
     return r
예제 #7
0
 def info(self, req) -> ResponseInfo:
     r = ResponseInfo()
     r.version = "1.0"
     r.last_block_height = 0
     r.last_block_app_hash = b''
     return r