Skip to content

Conversation

@czzarr
Copy link

@czzarr czzarr commented Sep 26, 2016

This PR adds code to print a readable asm version of the redeemScript of a P2WSH input in the getrawtransaction RPC call which is useful to explore that kind of transactions.

@czzarr
Copy link
Author

czzarr commented Sep 26, 2016

I'll make it compatible with @jnewbery when his PRs are merged.

}
in.push_back(Pair("txinwitness", txinwitness));
// try to parse the last item as a pubkey
// if someone constructed the script to look like a pubkey, then he's insane

Choose a reason for hiding this comment

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

nit: suggest you add a bit more context to this comment. eg:

In version 0, there are two valid witness types: P2WPKH and P2WSH. P2WPKH witnesses have two items on the witness stack, the second of which is a public key. We test whether the last item on the witness stack is a valid public key, and if it isn't we try to parse it as a redeem script.

Choose a reason for hiding this comment

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

Agreed, but aside from that LGTM.

@jnewbery
Copy link

Note that to make this compatible with #4 , you'll need to change ScriptPubKeyToJSON() to ScriptPubKeyToUniv().

@czzarr czzarr force-pushed the print-p2wsh-redeemscript-in-getrawtransaction branch from 101eb45 to 5f18004 Compare September 30, 2016 14:45
@czzarr
Copy link
Author

czzarr commented Sep 30, 2016

I have updated the comment as suggested and posted a PR to bitcoin/bitcoin bitcoin#8849

@czzarr czzarr closed this Sep 30, 2016
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.

4 participants