From 7b41a4e5ee58dec57d37c82016d6318cd0892c8d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 16 May 2022 16:35:53 -0700 Subject: static ip's and explicit listen addr for clightning --- docker-compose.dev.yml | 19 +++++++++++++++++-- docker-compose.yml | 17 ++++++++++++++++- sampleconfig/lightning/config | 1 + 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 7da9d0ff..2566f10a 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -12,6 +12,9 @@ services: # NODE_OPTIONS: --openssl-legacy-provider volumes: - ../coinos-ui:/app + networks: + default: + ipv4_address: 172.18.0.7 electrsb: image: ghcr.io/vulpemventures/electrs container_name: electrsb @@ -38,8 +41,11 @@ services: restart: unless-stopped ports: - 3095:3095 + networks: + default: + ipv4_address: 172.18.0.8 electrs-liquid: - image: asoltys/electrs-liquid:latest + image: ghcr.io/vulpemventures/electrs-liquid container_name: electrs depends_on: - liquid @@ -69,6 +75,9 @@ services: volumes: - ./config/liquid/:/config restart: unless-stopped + networks: + default: + ipv4_address: 172.18.0.9 esplora-liquid: image: vulpemventures/esplora:latest container_name: esplora-liquid @@ -81,6 +90,9 @@ services: ports: - ${LIQUID_ESPLORA_PORT}:5000 restart: unless-stopped + networks: + default: + ipv4_address: 172.18.0.10 clightning: image: asoltys/lightning container_name: cl @@ -89,7 +101,10 @@ services: volumes: - ./config/lightning:/root/.lightning restart: unless-stopped + networks: + default: + ipv4_address: 172.18.0.11 networks: default: external: - name: net \ No newline at end of file + name: net diff --git a/docker-compose.yml b/docker-compose.yml index 55e943da..c126d4ef 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,9 @@ services: volumes: - ./:/app - ./logs:/logs + networks: + default: + ipv4_address: 172.18.0.2 bitcoin: image: asoltys/bitcoin:latest container_name: bitcoin @@ -25,8 +28,11 @@ services: volumes: - ./config/bitcoin:/config restart: unless-stopped + networks: + default: + ipv4_address: 172.18.0.3 liquid: - image: ghcr.io/vulpemventures/elements:0.18.1.12 + image: ghcr.io/vulpemventures/elements container_name: liquid ports: - ${LIQUID_NODE_PORT}:7040 @@ -36,6 +42,9 @@ services: volumes: - ./config/liquid:/home/elements/.elements restart: unless-stopped + networks: + default: + ipv4_address: 172.18.0.4 lnd: image: lightninglabs/lnd:v0.14.1-beta container_name: lnd @@ -43,6 +52,9 @@ services: - ./config/lnd:/root/.lnd - ./config/bitcoin:/root/.bitcoin restart: unless-stopped + networks: + default: + ipv4_address: 172.18.0.5 maria: container_name: mariadb image: mariadb:10.6.1 @@ -53,6 +65,9 @@ services: - ./mysql:/var/lib/mysql ports: - 3307:3306 + networks: + default: + ipv4_address: 172.18.0.6 networks: default: external: diff --git a/sampleconfig/lightning/config b/sampleconfig/lightning/config index 14e913c3..c5f07630 100644 --- a/sampleconfig/lightning/config +++ b/sampleconfig/lightning/config @@ -5,3 +5,4 @@ bitcoin-rpcport=18443 bitcoin-rpcuser=admin1 bitcoin-rpcpassword=123 network=regtest +addr=172.18.0.11:9735 -- cgit v1.2.3 From 962807d8c7b31a18bbcb6c677047e057c0f519cc Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 18 May 2022 19:46:01 -0700 Subject: ddos foil --- routes/users.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/users.js b/routes/users.js index 549de828..6bf9a063 100644 --- a/routes/users.js +++ b/routes/users.js @@ -365,7 +365,7 @@ app.post( ); app.post( - "/taboggan", + "/doggin", ah(async (req, res) => { try { const { params, sig, key } = req.body; -- cgit v1.2.3 From ca7224037fb01ded28b51d765e040d5cad36183b Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 18 May 2022 22:53:43 -0400 Subject: auto confirm payments --- lib/sync.js | 12 ++++-------- routes/send.js | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/sync.js b/lib/sync.js index fedb6798..e217dcd0 100644 --- a/lib/sync.js +++ b/lib/sync.js @@ -116,7 +116,7 @@ const sync = async () => { preimage, rate: invoice.rate, received: true, - confirmed: false, + confirmed: true, network: "lightning", tip: invoice.tip, invoice_id: invoice.id, @@ -124,7 +124,7 @@ const sync = async () => { updatedAt: createdAt }); - // await account.increment({ balance: amount }); + await account.increment({ balance: amount }); l.info("lightning missing from account", account.id, amount); } @@ -152,7 +152,7 @@ const sync = async () => { const transactions = [ ...(await bc.listTransactions("*", 500)), ...(await lq.listTransactions("*", 500)) - ].filter(tx => ["send", "receive"].includes(tx.category)); + ].filter(tx => ["send", "receive"].includes(tx.category) && new Date(tx.time * 1000) > twoWeeksAgo); missed = transactions.filter( tx => @@ -163,7 +163,6 @@ const sync = async () => { for (let i = 0; i < missed.length; i++) { let p = unconfirmed.find(p => p.hash === missed[i].txid); - /* p.confirmed = 1; await db.transaction(async transaction => { @@ -175,7 +174,6 @@ const sync = async () => { emit(p.user.username, "account", p.account); emit(p.user.username, "payment", p); - */ l.info("unconfirmed tx", p.user_id, p.hash, p.address); } @@ -253,8 +251,7 @@ const sync = async () => { amount = toSats(amount); await db.transaction(async transaction => { - l.info("found pending balance", user.username, amount); - /* + l.info("found pending transaction", user.username, amount, hash); payments.push(hash); let p = await db.Payment.create( { @@ -278,7 +275,6 @@ const sync = async () => { emit(user.username, "account", account); emit(user.username, "payment", p); - */ }); } } diff --git a/routes/send.js b/routes/send.js index 5f1151c5..4c8afa34 100644 --- a/routes/send.js +++ b/routes/send.js @@ -61,7 +61,7 @@ module.exports = ah(async (req, res, next) => { rate: app.get("rates")[user.currency], currency: user.currency, confirmed: true, - hash: username ? `Payment to ${username}` : "Internal Transfer", + hash: `#${uuidv4().substr(0, 6)} ${(username ? `Payment to ${username}` : "Internal Transfer")}`, network: "COINOS" }; @@ -165,7 +165,7 @@ module.exports = ah(async (req, res, next) => { rate: app.get("rates")[recipient.currency] * spread, currency: recipient.currency, confirmed: true, - hash: "Payment from " + user.username, + hash: `#${uuidv4().substr(0,6)} Payment from ${user.username}`, memo, network: "COINOS", received: true -- cgit v1.2.3 From 47aeb5f041db40ef964116bbb4fe22ee8e8f64dd Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 3 Jun 2022 23:08:06 -0700 Subject: tweak createrawtransaction params --- routes/liquid/fee.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/routes/liquid/fee.js b/routes/liquid/fee.js index fad69f13..253810a9 100644 --- a/routes/liquid/fee.js +++ b/routes/liquid/fee.js @@ -49,14 +49,12 @@ liquidTx = async ({ address, asset, amount, feeRate, replaceable, user }) => { tx = await node.createRawTransaction( [], - { - [address]: (amount / SATS).toFixed(8) - }, + [{ + [address]: (amount / SATS).toFixed(8), + asset + }], 0, replaceable, - { - [address]: asset - } ); l.info("funding tx for fee estimate", tx); @@ -78,7 +76,7 @@ module.exports = ah(async (req, res) => { let tx = await liquidTx({ ...req.body, user: req.user }) res.send(tx); } catch (e) { - l.error("error estimating liquid fee", e.message); + l.error("error estimating liquid fee", e.message, e.stack); return res.status(500).send(e.message); } }); -- cgit v1.2.3