-
Notifications
You must be signed in to change notification settings - Fork 284
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
Propagate the user agent from node to pool #664
Conversation
Pull Request Test Coverage Report for Build 1584633147
💛 - Coveralls |
I think it's okay for users to rewrite Agent, but I was wondering if for general cases we should add special option, so they can just annotate hsd version. E.g. This way we don't lose information about original version. Ofc someone really wants to, they could use p.s. This is similar to |
@Falci could you also use that as an alternative in It could be: |
@nodech it sounds good. I'll work on that. |
I agree with @nodech I use this commit for easyhandshake: pinheadmz@8c4f397 |
agent: this.config.str('agent'), | ||
agentComment: this.config.str('agentComment'), |
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.
Can we just add one?
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.
The PR was about the first. You guys asked for this extra.
Why both?
Ofc someone really wants to, they could use agent to totally rewrite and that's okay as well, but in general this should give better alternative ?
if (options.agentComment) { | ||
assert(typeof options.agentComment === 'string'); | ||
|
||
let agentComment; | ||
if (this.agent.endsWith('/')) { | ||
agentComment = `${this.agent.slice(0, -1)}(${options.agentComment})/`; | ||
} else { | ||
agentComment = `${this.agent}(${options.agentComment})`; | ||
} | ||
; | ||
assert(agentComment.length <= 255); | ||
this.agent = agentComment; | ||
} | ||
|
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.
Many thoughts:
- assertion errors should report why they throw ("...must be string")
- comment should be appended to current (default) agent:
/hsd:v3.0.1/sinpapeles
- total string should be checked for length and asserted with explanation if error
- why do we care if the ua comment ends with a slash>
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.
This implementation follows @nodech's comment:
./hsd --agent-comment other-variation
- giving us version -/hsd:3.0.1(other-variation)/
.
@nodech maybe we need to agree on how this should work. Here's what I'm thinking:
Users that want to replace the entire agent string can fork hsd, but IMO this is the best way to add extra strings like bob wallet version and still get stats about hsd version deployment |
That sounds good with one modification: As for user agent comments, they are meant for something else. Currently, Let's add |
Ok SGTM. So you want to remove any trailing slashes from the input string and always add one back in the final output? What about the other special characters mentioned in the BIP? |
Because we are accepting whole version in the latter part of |
Hey, just checking in if it's ready to merge. I think it's fine to have both |
Closing this and moving discussion to updated PR #710 |
No description provided.