API auditor (#1002)

* just quick auditor

* fix for none balance

* handle node down case

Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>

Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
Gene Takavic
2022-09-23 16:33:51 +03:00
committed by GitHub
co-authored by calle
parent d8acad4282
commit e75610a04f
2 changed files with 31 additions and 1 deletions
+5
View File
@@ -177,6 +177,11 @@ async def get_wallet_for_key(
return Wallet(**row)
async def get_total_balance(conn: Optional[Connection] = None):
row = await (conn or db).fetchone("SELECT SUM(balance) FROM balances")
return 0 if row[0] is None else row[0]
# wallet payments
# ---------------