-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node: rescan expects buffer not string #21
Conversation
@@ -315,7 +315,7 @@ class NodeClient extends Client { | |||
if (start == null) | |||
start = 0; | |||
|
|||
assert(typeof start === 'number' || typeof start === 'string'); | |||
assert(typeof start === 'number' || Buffer.isBuffer(start)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tl;dr: should we keep the API consistent by accepting the String
creating the Buffer
for the users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These aren't HTTP API endpoints though, they're socket calls. All the others assert Buffers:
Lines 231 to 273 in aa246e2
/** | |
* Send a transaction. Do not wait for promise. | |
* @param {TX} tx | |
* @returns {Promise} | |
*/ | |
send(tx) { | |
assert(Buffer.isBuffer(tx)); | |
return this.call('send', tx); | |
} | |
/** | |
* Send a claim. Do not wait for promise. | |
* @param {Claim} claim | |
* @returns {Promise} | |
*/ | |
sendClaim(claim) { | |
assert(Buffer.isBuffer(claim)); | |
return this.call('send claim', claim); | |
} | |
/** | |
* Get name state. | |
* @param {Buffer} nameHash | |
* @returns {Promise} | |
*/ | |
getNameStatus(nameHash) { | |
assert(Buffer.isBuffer(nameHash)); | |
return this.call('get name', nameHash); | |
} | |
/** | |
* Set bloom filter. | |
* @param {Bloom} filter | |
* @returns {Promise} | |
*/ | |
setFilter(filter) { | |
assert(Buffer.isBuffer(filter)); | |
return this.call('set filter', filter); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This is as old as time. This is something I missed from the big string-to-buffer refactor. Not many people running hs-wallet as a separate daemon I guess. |
Closes handshake-org/hsd#357