refactor: move hashQueryRoutingTable to S5Node

This commit is contained in:
Derrick Hammer 2023-11-18 04:48:39 -05:00
parent d07351a928
commit 8091e7ab36
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 9 additions and 9 deletions

View File

@ -57,7 +57,8 @@ export default async function (
config: node.config, config: node.config,
}); });
const list = p2p.hashQueryRoutingTable.get(hash) || new Set<NodeId>(); const list =
node.hashQueryRoutingTable.get(hash.hashCode) || new Set<NodeId>();
for (const peerId of list) { for (const peerId of list) {
if (peerId.equals(nodeId)) { if (peerId.equals(nodeId)) {
continue; continue;
@ -74,5 +75,5 @@ export default async function (
} }
} }
} }
p2p.hashQueryRoutingTable.delete(hash); node.hashQueryRoutingTable.delete(hash.hashCode);
} }

View File

@ -50,6 +50,12 @@ export class S5Node {
private _started = false; private _started = false;
private _hashQueryRoutingTable: Map<number, Set<NodeId>> = new Map();
get hashQueryRoutingTable(): Map<number, Set<NodeId>> {
return this._hashQueryRoutingTable;
}
get started(): boolean { get started(): boolean {
return this._started; return this._started;
} }

View File

@ -48,13 +48,6 @@ export class P2PService extends EventEmitter {
node.services.p2p = this; node.services.p2p = this;
} }
private _hashQueryRoutingTable: Map<Multihash, Set<NodeId>> = new Map();
get hashQueryRoutingTable(): Map<Multihash, Set<NodeId>> {
return this._hashQueryRoutingTable;
}
private _networkId?: string; private _networkId?: string;
get networkId(): string { get networkId(): string {