aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-02-20 14:04:31 -0800
committerAdam Soltys <[email protected]>2023-02-20 14:04:31 -0800
commit12babb7d4e75066e29e82a2a64bef4099edeeff4 (patch)
tree84d09ef58f9366ba19efb218754179e0c974d962
parent00bbf89eece308863f4561fff2e8d0967ebecac9 (diff)
downloadcoinos-server-12babb7d4e75066e29e82a2a64bef4099edeeff4.tar.gz
coinos-server-12babb7d4e75066e29e82a2a64bef4099edeeff4.zip
fix balances endpoint
-rw-r--r--routes/info.js10
1 files changed, 2 insertions, 8 deletions
diff --git a/routes/info.js b/routes/info.js
index 017e473a..eda028d2 100644
--- a/routes/info.js
+++ b/routes/info.js
@@ -6,16 +6,10 @@ export default {
let lnchannel;
let lnwallet;
- const stream = db.scanStream({
- match: "balance:*",
- count: 100
- });
-
let b = 0;
- for await (let keys of stream) {
- for (let k of keys) b += parseInt(await db.get(k));
+ for await (let k of db.scanIterator({ MATCH: "balance:*" })) {
+ b += parseInt(await db.get(k));
}
- console.log(b);
const funds = await ln.listfunds();
lnchannel = parseInt(funds.channels.reduce((a, b) => a + b.channel_sat, 0));