addrindexer: use network for getPrefix.
This commit is contained in:
parent
7e49be2a07
commit
0f6ef910b0
@ -141,7 +141,7 @@ class AddrIndexer extends Indexer {
|
|||||||
let hasAddress = false;
|
let hasAddress = false;
|
||||||
|
|
||||||
for (const addr of tx.getAddresses(view)) {
|
for (const addr of tx.getAddresses(view)) {
|
||||||
const prefix = addr.getPrefix();
|
const prefix = addr.getPrefix(this.network);
|
||||||
|
|
||||||
if (prefix < 0)
|
if (prefix < 0)
|
||||||
continue;
|
continue;
|
||||||
@ -178,7 +178,7 @@ class AddrIndexer extends Indexer {
|
|||||||
let hasAddress = false;
|
let hasAddress = false;
|
||||||
|
|
||||||
for (const addr of tx.getAddresses(view)) {
|
for (const addr of tx.getAddresses(view)) {
|
||||||
const prefix = addr.getPrefix();
|
const prefix = addr.getPrefix(this.network);
|
||||||
|
|
||||||
if (prefix < 0)
|
if (prefix < 0)
|
||||||
continue;
|
continue;
|
||||||
@ -223,7 +223,7 @@ class AddrIndexer extends Indexer {
|
|||||||
throw new Error('Limit above max of ${this.maxTxs}.');
|
throw new Error('Limit above max of ${this.maxTxs}.');
|
||||||
|
|
||||||
const hash = Address.getHash(addr);
|
const hash = Address.getHash(addr);
|
||||||
const prefix = addr.getPrefix();
|
const prefix = addr.getPrefix(this.network);
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
limit,
|
limit,
|
||||||
|
|||||||
@ -20,9 +20,12 @@ class AddrIndexer {
|
|||||||
/**
|
/**
|
||||||
* Create TX address index.
|
* Create TX address index.
|
||||||
* @constructor
|
* @constructor
|
||||||
|
* @param {Network} network
|
||||||
*/
|
*/
|
||||||
|
|
||||||
constructor() {
|
constructor(network) {
|
||||||
|
this.network = network;
|
||||||
|
|
||||||
// Map of addr->entries.
|
// Map of addr->entries.
|
||||||
this.index = new BufferMap();
|
this.index = new BufferMap();
|
||||||
|
|
||||||
@ -36,7 +39,7 @@ class AddrIndexer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getKey(addr) {
|
getKey(addr) {
|
||||||
const prefix = addr.getPrefix();
|
const prefix = addr.getPrefix(this.network);
|
||||||
|
|
||||||
if (prefix < 0)
|
if (prefix < 0)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -73,7 +73,7 @@ class Mempool extends EventEmitter {
|
|||||||
this.spents = new BufferMap();
|
this.spents = new BufferMap();
|
||||||
this.rejects = new RollingFilter(120000, 0.000001);
|
this.rejects = new RollingFilter(120000, 0.000001);
|
||||||
|
|
||||||
this.addrindex = new AddrIndexer();
|
this.addrindex = new AddrIndexer(this.network);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user