Skip to content

Commit

Permalink
Merge pull request bcoin-org#581 from tuxcanfly/fix-addr-gethash
Browse files Browse the repository at this point in the history
http: fix address/coins by address to use Address instead of string
  • Loading branch information
tuxcanfly authored Aug 24, 2018
2 parents 7178d9b + 175ff79 commit ac0179c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/node/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const sha256 = require('bcrypto/lib/sha256');
const random = require('bcrypto/lib/random');
const ccmp = require('bcrypto/lib/ccmp');
const util = require('../utils/util');
const Address = require('../primitives/address');
const TX = require('../primitives/tx');
const Outpoint = require('../primitives/outpoint');
const Network = require('../protocol/network');
Expand Down Expand Up @@ -156,7 +157,8 @@ class HTTP extends Server {
enforce(address, 'Address is required.');
enforce(!this.chain.options.spv, 'Cannot get coins in SPV mode.');

const coins = await this.node.getCoinsByAddress(address);
const addr = Address.fromString(address, this.network);
const coins = await this.node.getCoinsByAddress(addr);
const result = [];

for (const coin of coins)
Expand Down Expand Up @@ -230,7 +232,8 @@ class HTTP extends Server {
enforce(address, 'Address is required.');
enforce(!this.chain.options.spv, 'Cannot get TX in SPV mode.');

const metas = await this.node.getMetaByAddress(address);
const addr = Address.fromString(address, this.network);
const metas = await this.node.getMetaByAddress(addr);
const result = [];

for (const meta of metas) {
Expand Down

0 comments on commit ac0179c

Please sign in to comment.