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;
|
||||
|
||||
for (const addr of tx.getAddresses(view)) {
|
||||
const prefix = addr.getPrefix();
|
||||
const prefix = addr.getPrefix(this.network);
|
||||
|
||||
if (prefix < 0)
|
||||
continue;
|
||||
@ -178,7 +178,7 @@ class AddrIndexer extends Indexer {
|
||||
let hasAddress = false;
|
||||
|
||||
for (const addr of tx.getAddresses(view)) {
|
||||
const prefix = addr.getPrefix();
|
||||
const prefix = addr.getPrefix(this.network);
|
||||
|
||||
if (prefix < 0)
|
||||
continue;
|
||||
@ -223,7 +223,7 @@ class AddrIndexer extends Indexer {
|
||||
throw new Error('Limit above max of ${this.maxTxs}.');
|
||||
|
||||
const hash = Address.getHash(addr);
|
||||
const prefix = addr.getPrefix();
|
||||
const prefix = addr.getPrefix(this.network);
|
||||
|
||||
const opts = {
|
||||
limit,
|
||||
|
||||
@ -20,9 +20,12 @@ class AddrIndexer {
|
||||
/**
|
||||
* Create TX address index.
|
||||
* @constructor
|
||||
* @param {Network} network
|
||||
*/
|
||||
|
||||
constructor() {
|
||||
constructor(network) {
|
||||
this.network = network;
|
||||
|
||||
// Map of addr->entries.
|
||||
this.index = new BufferMap();
|
||||
|
||||
@ -36,7 +39,7 @@ class AddrIndexer {
|
||||
}
|
||||
|
||||
getKey(addr) {
|
||||
const prefix = addr.getPrefix();
|
||||
const prefix = addr.getPrefix(this.network);
|
||||
|
||||
if (prefix < 0)
|
||||
return null;
|
||||
|
||||
@ -73,7 +73,7 @@ class Mempool extends EventEmitter {
|
||||
this.spents = new BufferMap();
|
||||
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