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

multi: add optional version arg to decodescript rpc. #1731

Merged
merged 1 commit into from
Jun 27, 2019

Conversation

dnldd
Copy link
Member

@dnldd dnldd commented May 3, 2019

This add an optional version parameter to the decodescript rpc. It defaults to version zero if not set.

dcrjson/chainsvrcmds.go Outdated Show resolved Hide resolved
dcrjson/chainsvrcmds.go Outdated Show resolved Hide resolved
@dnldd dnldd force-pushed the add_version_decodescript_rpc branch from 02b8c37 to 41fd98d Compare June 26, 2019 21:46
@dnldd dnldd changed the title multi: add version arg to decodescript rpc. multi: add optional version arg to decodescript rpc. Jun 26, 2019
@dnldd dnldd force-pushed the add_version_decodescript_rpc branch from 41fd98d to bbf3191 Compare June 26, 2019 22:00
Copy link
Member

@davecgh davecgh left a comment

Choose a reason for hiding this comment

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

This is closer, but it still needs to add an additional test after the name: "decodescript", test for the optional parameter named decodescript optional to be consistent with the other tests. That will also expose that a new Uint16 function is needed to be consistent with the existing Uint, Uint32, and Uint64 functions now that one of the concrete command constructor parameters requires it.

@dnldd dnldd force-pushed the add_version_decodescript_rpc branch from bbf3191 to bb7b4c1 Compare June 26, 2019 23:40
Copy link
Member

@davecgh davecgh left a comment

Choose a reason for hiding this comment

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

I approved this as it's sufficient until further script version enhancements are made although, as can be shown from the additional test output below, unsupported versions aren't really being handled as they probably should be, but they are at least marked as nonstandard.

$ dcrctl decodescript 76a914000000000000000000000000000000000000000088ac
{
  "asm": "OP_DUP OP_HASH160 0000000000000000000000000000000000000000 OP_EQUALVERIFY OP_CHECKSIG",
  "reqSigs": 1,
  "type": "pubkeyhash",
  "addresses": [
    "DsQxuVRvS4eaJ42dhQEsCXauMWjvopWgrVg"
  ],
  "p2sh": "DcvE76ks4SjLUymP6GLUZL4vSDwTJGiUS5T"
}

$ dcrctl decodescript 76a914000000000000000000000000000000000000000088ac 0
{
  "asm": "OP_DUP OP_HASH160 0000000000000000000000000000000000000000 OP_EQUALVERIFY OP_CHECKSIG",
  "reqSigs": 1,
  "type": "pubkeyhash",
  "addresses": [
    "DsQxuVRvS4eaJ42dhQEsCXauMWjvopWgrVg"
  ],
  "p2sh": "DcvE76ks4SjLUymP6GLUZL4vSDwTJGiUS5T"
}

$ dcrctl decodescript 76a914000000000000000000000000000000000000000088ac 1
{
  "asm": "OP_DUP OP_HASH160 0000000000000000000000000000000000000000 OP_EQUALVERIFY OP_CHECKSIG",
  "type": "nonstandard",
  "p2sh": "DcvE76ks4SjLUymP6GLUZL4vSDwTJGiUS5T"
}

@davecgh davecgh merged commit c831942 into decred:master Jun 27, 2019
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.

2 participants