From a7dfe14aea50f68cd8b26f0ab8b33ec6ea75750b Mon Sep 17 00:00:00 2001 From: Stefan Stammberger Date: Sun, 28 Nov 2021 08:58:07 +0100 Subject: [PATCH] feat: round verification_progress value in SSE Bitcoin Core calculates the blockchain verification by including unconfirmed transactions. This means that everytime there is a new transaction, a `btc_info` event is fired through the SSE channel. For clients this information is usually not useful beyond two digits. Solution: round to two digits for SSE events. The full floating point value can still be fetched through `/bitcoin/get-blockhain-info` closes #52 --- app/repositories/bitcoin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/repositories/bitcoin.py b/app/repositories/bitcoin.py index 4c7b479..a4ef71c 100644 --- a/app/repositories/bitcoin.py +++ b/app/repositories/bitcoin.py @@ -77,6 +77,7 @@ async def _handle_gather_bitcoin_status(): while True: try: info = await get_btc_info() + info.verification_progress = round(info.verification_progress, 2) except HTTPException as e: print(e) await asyncio.sleep(2)