Node RPC getnames Response Exceeds Limit
The JSON response from the RPC getnames has gotten too large and will no longer return. This is a problem because there are currently applications that exist that are using it. It was a known issue that this would become a denial of service issue over time as the number of names registered grew.
$ ./bin/hsd-cli rpc getnames
Error: Response exceeded limit.
at Request.handleResponse (/home/tynes/Projects/github.com/handshake-org/hsd/node_modules/brq/lib/request.js:508:19)
at ClientRequest.emit (events.js:198:13)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:111:17)
at Socket.socketOnData (_http_client.js:451:20)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead (internal/stream_base_commons.js:94:17)
A short term solution is to use https://github.com/handshake-org/hs-client/pull/27 and pass in a much larger limit parameter with the --limit flag.
A longer term solution would be to update this RPC such that it allows for pagination. It may also make sense to add an HTTP endpoint that works with pagination and/or deprecate the RPC itself.
One thing we can consider is removing this RPC completely but adding a new optional
--index-names
Where we could develop better HTTP API endpoints for the "block explorer" type applications similar to coins by address, etc (which we will need to remove in another 10 years or so..) Filtering and pagination would still be required though if users expect to get "all" names.
Maybe its time to take a look at https://github.com/handshake-org/hsd/pull/69, which migrates the bcoin style indexers to hsd. The NameIndexer could be built on top of this.