-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[RPC][Bitcoin-TX] Add support for sequence number #7957
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
Conversation
877b581 to
e59336f
Compare
|
Subset PR as requested in #7865. |
| const UniValue& sequenceObj = find_value(o, "sequence"); | ||
| if (sequenceObj.isNum()) | ||
| nSequence = sequenceObj.get_int(); | ||
|
|
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.
Neat, this is useful. I was trying it out and think that being able to use hex is a little easier. Maybe something like this:
if (sequenceObj.isNum())
{
nSequence = sequenceObj.get_int();
} else if (sequenceObj.isStr() /*&& IsHex(sequenceObj.get_str())*/)
{
nSequence = strtoul(sequenceObj.get_str().c_str(), NULL, 16);
}
I commented out the IsHex check because I think it might be too restrictive (but left it there to see what you thought).
With this little patch, these work too:
createrawtransaction '[{"txid":"d5eb7e43a7cf85c5bee47a7a33c8351b8dcc013616a7c6bdc3af49538d986221","vout":0,"sequence":"0xfffffffe"}]' '{"mifzFw94bSGApmx2eWw1nzLCfEeq4cTwey":49.99}' 0
createrawtransaction '[{"txid":"d5eb7e43a7cf85c5bee47a7a33c8351b8dcc013616a7c6bdc3af49538d986221","vout":0,"sequence":"fffffffd"}]' '{"mifzFw94bSGApmx2eWw1nzLCfEeq4cTwey":49.99}' 0
createrawtransaction '[{"txid":"d5eb7e43a7cf85c5bee47a7a33c8351b8dcc013616a7c6bdc3af49538d986221","vout":0,"sequence":"f"}]' '{"mifzFw94bSGApmx2eWw1nzLCfEeq4cTwey":49.99}' 0
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.
Thanks for the review!
Hmm... I'm not sure if we want utility function (hex->int) on machine-to-machine communication (RPC).
But no strong opinion.
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.
Good point, I was thinking of only the GUI RPC console use (that's where the hex conversion is useful to me).
If your threat model includes hostile input on this interface, then the IsHex check could be used and the length of the string could be validated to be <= 8. That would likely be sufficient input validation. Adding back IsHex makes my first and third examples invalid. The sequence value of the third would need to change to "0f" instead of just "f".
|
utACK e59336f |
|
utACK e59336f |
|
Added a commit with two |
|
utACK ae357d5 |
CLI binary improvements Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#5936 - bitcoin/bitcoin#7550 - bitcoin/bitcoin#7989 - bitcoin/bitcoin#7957 - bitcoin/bitcoin#9067 - bitcoin/bitcoin#9220 Excludes any changes that affected the QT code.
…quence number bitcoin/bitcoin#7957 - [RPC][Bitcoin-TX] Add support for sequence number bitcoin/bitcoin#8164 - [Bitcoin-Tx] fix missing test fixtures, fix 32bit atoi issue bitcoin/bitcoin#8171 - [RPC] Fix createrawtx sequence number unsigned int parsing [RPC][Bitcoin-TX] Add support for sequence number
…quence number bitcoin/bitcoin#7957 - [RPC][Bitcoin-TX] Add support for sequence number bitcoin/bitcoin#8164 - [Bitcoin-Tx] fix missing test fixtures, fix 32bit atoi issue bitcoin/bitcoin#8171 - [RPC] Fix createrawtx sequence number unsigned int parsing [RPC][Bitcoin-TX] Add support for sequence number
No description provided.