From 14ac642bdbb2abf8351fb02a2e15a6478ed60f83 Mon Sep 17 00:00:00 2001 From: Stoyan Zhekov Date: Wed, 29 Jul 2020 00:10:26 +0900 Subject: [PATCH] Bulk mempool response format fixed --- src/routes/v3/electrumx.js | 6 +++--- test/v3/a01-electrumx.js | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/routes/v3/electrumx.js b/src/routes/v3/electrumx.js index 19a2bd4..f69e958 100644 --- a/src/routes/v3/electrumx.js +++ b/src/routes/v3/electrumx.js @@ -54,8 +54,8 @@ class Electrum { _this.router.post('/balance', _this.balanceBulk) _this.router.get('/transactions/:address', _this.getTransactions) _this.router.post('/transactions', _this.transactionsBulk) - _this.router.get('/mempool/:address', _this.getMempool) - _this.router.post('/mempool', _this.mempoolBulk) + _this.router.get('/unconfirmed/:address', _this.getMempool) + _this.router.post('/unconfirmed', _this.mempoolBulk) } // Initializes a connection to electrum servers. @@ -894,7 +894,7 @@ class Electrum { res.status(200) return res.json({ success: true, - mempool: result + utxos: result }) } catch (err) { wlogger.error('Error in electrumx.js/mempoolBulk().', err) diff --git a/test/v3/a01-electrumx.js b/test/v3/a01-electrumx.js index dcb588f..035ccde 100644 --- a/test/v3/a01-electrumx.js +++ b/test/v3/a01-electrumx.js @@ -1252,16 +1252,16 @@ describe('#ElectrumX Router', () => { assert.property(result, 'success') assert.equal(result.success, true) - assert.property(result, 'mempool') - assert.isArray(result.mempool) + assert.property(result, 'utxos') + assert.isArray(result.utxos) - assert.property(result.mempool[0], 'address') - assert.property(result.mempool[0], 'utxos') + assert.property(result.utxos[0], 'address') + assert.property(result.utxos[0], 'utxos') - assert.isArray(result.mempool[0].utxos) - assert.property(result.mempool[0].utxos[0], 'height') - assert.property(result.mempool[0].utxos[0], 'tx_hash') - assert.property(result.mempool[0].utxos[0], 'fee') + assert.isArray(result.utxos[0].utxos) + assert.property(result.utxos[0].utxos[0], 'height') + assert.property(result.utxos[0].utxos[0], 'tx_hash') + assert.property(result.utxos[0].utxos[0], 'fee') }) it('should get mempool for multiple addresses', async () => { @@ -1288,9 +1288,9 @@ describe('#ElectrumX Router', () => { assert.property(result, 'success') assert.equal(result.success, true) - assert.isArray(result.mempool) - assert.isArray(result.mempool[0].utxos) - assert.equal(result.mempool.length, 2, '2 outputs for 2 inputs') + assert.isArray(result.utxos) + assert.isArray(result.utxos[0].utxos) + assert.equal(result.utxos.length, 2, '2 outputs for 2 inputs') }) }) })