Skip to content
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

Merged
merged 1 commit into from
Feb 7, 2020

Conversation

pinheadmz
Copy link
Member

@@ -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));
Copy link
Contributor

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.

handshake-org/hsd#357 (comment)

Copy link
Member Author

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:

hs-client/lib/node.js

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);
}

Copy link
Contributor

@boymanjor boymanjor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@boymanjor boymanjor merged commit 08d604a into handshake-org:master Feb 7, 2020
@chjj
Copy link
Contributor

chjj commented Feb 14, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remote wallet: several calls send buffers instead of strings to HTTP endpoints
3 participants