mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-21 16:52:04 -07:00
Bulk mempool response format fixed
This commit is contained in:
@@ -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)
|
||||
|
||||
+11
-11
@@ -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')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user