node: reserve 'ns' and 'rs' from plugin ids and add to get()

This commit is contained in:
Matthew Zipkin 2021-02-09 13:42:07 -05:00
parent b66085ac0c
commit 27fe87e509
No known key found for this signature in database
GPG key ID: E7E2984B6289C93A

View file

@ -342,6 +342,8 @@ class Node extends EventEmitter {
case 'pool':
case 'rpc':
case 'http':
case 'ns':
case 'rs':
assert(false, `${plugin.id} is already added.`);
break;
}
@ -401,6 +403,12 @@ class Node extends EventEmitter {
case 'http':
assert(this.http, 'http is not loaded.');
return this.http;
case 'rs':
assert(this.rs, 'rs is not loaded.');
return this.rs;
case 'ns':
assert(this.ns, 'ns is not loaded.');
return this.ns;
}
return this.plugins[name] || null;