Revert "Some minor fixes"

This commit is contained in:
Igor Korsakov 2019-03-06 20:14:39 +00:00 committed by GitHub
parent 1da578e8a4
commit 31b718e115
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 33 deletions

View File

@ -1,13 +1,7 @@
const fs = require('fs')
const path = require('path')
// setup bitcoind rpc // setup bitcoind rpc
const config = require('./config'); const config = require('./config');
let jayson = require('jayson/promise'); let jayson = require('jayson/promise');
let url = require('url'); let url = require('url');
let rpc = url.parse(config.bitcoind.rpc); let rpc = url.parse(config.bitcoind.rpc);
rpc.timeout = 5000; rpc.timeout = 5000;
rpc.rejectUnauthorized = false module.exports = jayson.client.http(rpc);
rpc.ecdhCurve = 'auto'
const client = jayson.client.https(rpc)
module.exports = client;

View File

@ -282,14 +282,13 @@ export class User {
let txs = await this._bitcoindrpc.request('listtransactions', [addr, 100500, 0, true]); let txs = await this._bitcoindrpc.request('listtransactions', [addr, 100500, 0, true]);
txs = txs.result; txs = txs.result;
let result = []; let result = [];
if(!txs===null) { for (let tx of txs) {
for (let tx of txs) { if (tx.confirmations >= 3) {
if (tx.confirmations >= 3) { tx.type = 'bitcoind_tx';
tx.type = 'bitcoind_tx'; result.push(tx);
result.push(tx);
}
} }
} }
let range = await this._redis.lrange('txs_for_' + this._userid, 0, -1); let range = await this._redis.lrange('txs_for_' + this._userid, 0, -1);
for (let invoice of range) { for (let invoice of range) {
invoice = JSON.parse(invoice); invoice = JSON.parse(invoice);
@ -314,6 +313,7 @@ export class User {
delete invoice.decoded; delete invoice.decoded;
result.push(invoice); result.push(invoice);
} }
return result; return result;
} }
@ -332,11 +332,9 @@ export class User {
let txs = await this._bitcoindrpc.request('listtransactions', [addr, 100500, 0, true]); let txs = await this._bitcoindrpc.request('listtransactions', [addr, 100500, 0, true]);
txs = txs.result; txs = txs.result;
let result = []; let result = [];
if(!txs === null) { for (let tx of txs) {
for (let tx of txs) { if (tx.confirmations < 3) {
if (tx.confirmations < 3) { result.push(tx);
result.push(tx);
}
} }
} }
return result; return result;

View File

@ -1,16 +1,17 @@
let config = { let config = {
bitcoind: { bitcoind: {
rpc: 'https://kek:kek@127.0.0.1:18334', rpc: 'http://login:password@1.1.1.1:8332',
}, },
redis: { redis: {
port: 6379, port: 12914,
host: '127.0.0.1', host: '1.1.1.1',
family: 4, family: 4,
password: '', password: 'password',
db: 0, db: 0,
}, },
lnd: { lnd: {
url: '127.0.0.1:10009', url: '1.1.1.1:10009',
password: '',
}, },
}; };

34
package-lock.json generated
View File

@ -2376,11 +2376,13 @@
}, },
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true "bundled": true,
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -2393,15 +2395,18 @@
}, },
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true "bundled": true,
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true "bundled": true,
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true "bundled": true,
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -2504,7 +2509,8 @@
}, },
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true "bundled": true,
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -2514,6 +2520,7 @@
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -2526,17 +2533,20 @@
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true "bundled": true,
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.2.4", "version": "2.2.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.1", "safe-buffer": "^5.1.1",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -2553,6 +2563,7 @@
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -2625,7 +2636,8 @@
}, },
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true "bundled": true,
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -2635,6 +2647,7 @@
"once": { "once": {
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -2740,6 +2753,7 @@
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@ -2868,9 +2882,9 @@
"integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA=="
}, },
"grpc": { "grpc": {
"version": "1.19.0", "version": "1.17.0-pre1",
"resolved": "https://registry.npmjs.org/grpc/-/grpc-1.19.0.tgz", "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.17.0-pre1.tgz",
"integrity": "sha512-xX+jZ1M3YXjngsRj/gTxB4EwM0WoWUr54DmyNq9xTeg1oSuVaTPD/PK9wnZKOJWTt1pkeFspXqwJPhddZNxHOA==", "integrity": "sha512-LWoGYW+ylOo2Ldvq/1i/SEwDsIxmDEJK9KoHPHEQkkwdG5zC+9D3/wJsgf/JFvpUoHrPdzLfBUqxfzRVCR90jw==",
"requires": { "requires": {
"lodash.camelcase": "^4.3.0", "lodash.camelcase": "^4.3.0",
"lodash.clone": "^4.5.0", "lodash.clone": "^4.5.0",