obelisk

Electrum server using libbitcoin as its backend
git clone https://git.parazyd.org/obelisk
Log | Files | Refs | README | LICENSE

commit bc14baed27380fe6140fc25cb18f951ad942b33f
parent 90a851773b817fdc4d19bcd2d1bc72c4e8905c8d
Author: parazyd <parazyd@dyne.org>
Date:   Mon, 19 Apr 2021 12:35:46 +0200

protocol/server.banner: Fetch libbitcoin server version for info.

Diffstat:
Mobelisk/protocol.py | 8+++++++-
Mobelisk/zeromq.py | 8++++++++
2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/obelisk/protocol.py b/obelisk/protocol.py @@ -644,7 +644,13 @@ class ElectrumProtocol(asyncio.Protocol): # pylint: disable=R0904,R0902 """Method: server.banner Return a banner to be shown in the Electrum console. """ - return {"result": BANNER} + _, bsversion = await self.bx.server_version() + banner = "%s\nobelisk version: %s\nlibbitcoin-server version: %s" % ( + BANNER, + VERSION, + bsversion.decode(), + ) + return {"result": banner} async def donation_address(self, writer, query): # pylint: disable=W0613 """Method: server.donation_address diff --git a/obelisk/zeromq.py b/obelisk/zeromq.py @@ -296,6 +296,14 @@ class Client: assert response.request_id == request.id_ return response.error_code, response.data + async def server_version(self): + """Get the libbitcoin-server version""" + command = b"server.version" + error_code, data = await self._simple_request(command, b"") + if error_code: + return error_code, None + return error_code, data + async def fetch_last_height(self): """Fetch the blockchain tip and return integer height""" command = b"blockchain.fetch_last_height"