print P2WSH redeemScript in getrawtransaction if it s not a pubkey#8849
Closed
czzarr wants to merge 2 commits intobitcoin:masterfrom
Closed
print P2WSH redeemScript in getrawtransaction if it s not a pubkey#8849czzarr wants to merge 2 commits intobitcoin:masterfrom
czzarr wants to merge 2 commits intobitcoin:masterfrom
Conversation
jl2012
reviewed
Sep 30, 2016
src/rpc/rawtransaction.cpp
Outdated
| CScript redeemScript(tx.wit.vtxinwit[i].scriptWitness.stack.back().begin(), tx.wit.vtxinwit[i].scriptWitness.stack.back().end()); | ||
| UniValue r(UniValue::VOBJ); | ||
| ScriptPubKeyToJSON(redeemScript, r, true); | ||
| in.push_back(Pair("redeemScript", r)); |
Contributor
There was a problem hiding this comment.
This is called witnessScript in BIP141
Contributor
Author
There was a problem hiding this comment.
I renamed the variables.
Member
|
Closing this due to inactivity. @czzarr If this is something that you would still like to see merged, please rebase and feel free to reopen. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds code to print a readable
asmversion of theredeemScriptof aP2WSHinput in thegetrawtransactionRPC call which is useful to explore that kind of transactions.Example (on testnet3):
./bitcoin-cli getrawtransaction cd56a4b017bf5aeeb86e1397ac91bb9b4ee091d3be1c89b11b08c196468464bf 1will output the following (note the newredeemScriptkey):{ "hex": "020000000001014558b8bc7f79efde796a90dca073e0808115365bb792db673cecf323c4eda2b40000000000ffffffff010eb50c00000000002200201d68ed9621fc634989c9988eda4883de4b3c699a154739a28891cb893ee7335c04004730440220120592e838230fb57292258dc98b6603ffd367adefb8f33fdea8b242f92823bc0220441d5fc90f6a3f61678db7bdb8256a61b08468fccad841841ec53791b27b002901483045022100bb3beffa751d485228d84513d84db6d2125af8f51bbaf6dd9a4a6ecbd7f73766022070b3478448192fd0d386a47e9a80b7d66839594526cdf33819c05449714c1242014752210251873cb58e82b8ba295cbaeb31bf5ce546182c6ff094b8c1fd0b33f82299d57721038f199dfacc8d2c83856d4a2ebda9f676962c880f7df3431fa47175940a1e101b52ae00000000", "txid": "cd56a4b017bf5aeeb86e1397ac91bb9b4ee091d3be1c89b11b08c196468464bf", "hash": "28961e39115f22896565e184beeb659ab68f6a8f9f0e4b8ca33699e837c4ca06", "size": 315, "vsize": 150, "version": 2, "locktime": 0, "vin": [ { "txid": "b4a2edc423f3ec3c67db92b75b36158180e073a0dc906a79deef797fbcb85845", "vout": 0, "scriptSig": { "asm": "", "hex": "" }, "txinwitness": [ "", "30440220120592e838230fb57292258dc98b6603ffd367adefb8f33fdea8b242f92823bc0220441d5fc90f6a3f61678db7bdb8256a61b08468fccad841841ec53791b27b002901", "3045022100bb3beffa751d485228d84513d84db6d2125af8f51bbaf6dd9a4a6ecbd7f73766022070b3478448192fd0d386a47e9a80b7d66839594526cdf33819c05449714c124201", "52210251873cb58e82b8ba295cbaeb31bf5ce546182c6ff094b8c1fd0b33f82299d57721038f199dfacc8d2c83856d4a2ebda9f676962c880f7df3431fa47175940a1e101b52ae" ], "redeemScript": { "asm": "2 0251873cb58e82b8ba295cbaeb31bf5ce546182c6ff094b8c1fd0b33f82299d577 038f199dfacc8d2c83856d4a2ebda9f676962c880f7df3431fa47175940a1e101b 2 OP_CHECKMULTISIG", "hex": "52210251873cb58e82b8ba295cbaeb31bf5ce546182c6ff094b8c1fd0b33f82299d57721038f199dfacc8d2c83856d4a2ebda9f676962c880f7df3431fa47175940a1e101b52ae", "reqSigs": 2, "type": "multisig", "addresses": [ "mzLfZ7AJNtrcBZqXYXkMXRty6HoQB31Sbo", "n1ANhQLAaEyswK9VWpEqCyTfgFvwtqtAYi" ] }, "sequence": 4294967295 } ], "vout": [ { "value": 0.00832782, "n": 0, "scriptPubKey": { "asm": "0 1d68ed9621fc634989c9988eda4883de4b3c699a154739a28891cb893ee7335c", "hex": "00201d68ed9621fc634989c9988eda4883de4b3c699a154739a28891cb893ee7335c", "type": "witness_v0_scripthash" } } ], "blockhash": "00000000000000fd63636cdfdf9b5469b5cc57b379c40e12ecda58b3dcc7e932", "confirmations": 36672, "time": 1474472930, "blocktime": 1474472930 }