Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Add witness data output to TxInError messages #8384
Conversation
MarcoFalke
added
the
RPC/REST/ZMQ
label
Jul 20, 2016
mcelrath
commented
Jul 20, 2016
|
Tested ACK Works fine with |
|
utACK 73c5eb1 |
|
Does this need to be tested in the RPC tests? |
|
@laanwj added basic test check for new field |
added a commit
to bitcoinknots/bitcoin
that referenced
this pull request
Oct 20, 2016
added a commit
to bitcoinknots/bitcoin
that referenced
this pull request
Oct 20, 2016
|
utACK 34bbc0d Needs rebase. |
|
Rebased |
|
utACK cb70b74 |
| @@ -582,11 +582,16 @@ UniValue decodescript(const JSONRPCRequest& request) | ||
| } | ||
| /** Pushes a JSON object for script verification or signing errors to vErrorsRet. */ | ||
| -static void TxInErrorToJSON(const CTxIn& txin, UniValue& vErrorsRet, const std::string& strMessage) | ||
| +static void TxInErrorToJSON(const CTxIn& txin, const CScriptWitness witness, UniValue& vErrorsRet, const std::string& strMessage) |
|
Squash? |
|
squashed |
|
This need anything for merge? |
| @@ -820,9 +825,13 @@ UniValue signrawtransaction(const JSONRPCRequest& request) | ||
| // Sign what we can: | ||
| for (unsigned int i = 0; i < mergedTx.vin.size(); i++) { | ||
| CTxIn& txin = mergedTx.vin[i]; | ||
| + CScriptWitness witness; | ||
| + if (txin.scriptWitness.stack.size() >= i + 1) { |
jnewbery
Mar 3, 2017
Member
I think this is the wrong check. You're testing the size of the witness stack for this particular CTxIn, but I think what you intend is to check for the existence of a witness for this CTxIn. I think the test you need is:
if (!txin.scriptWitness.IsNull()) {
Your test will fail if (for example) TxIn in postion 3 has only 2 items on its witness stack.
|
@jnewbery you're right, bad rebase. Sorry for not being careful. Check isn't even needed. |
mchrostowski
suggested changes
May 16, 2017
Minor change suggestions to make the PR smaller and its changes more consistent with existing code.
| @@ -582,11 +582,16 @@ UniValue decodescript(const JSONRPCRequest& request) | ||
| } | ||
| /** Pushes a JSON object for script verification or signing errors to vErrorsRet. */ | ||
| -static void TxInErrorToJSON(const CTxIn& txin, UniValue& vErrorsRet, const std::string& strMessage) | ||
| +static void TxInErrorToJSON(const CTxIn& txin, const CScriptWitness& witness, UniValue& vErrorsRet, const std::string& strMessage) |
mchrostowski
May 16, 2017
Why take an extra argument here?
In all use cases witness is txin.witness. More concise change if the method simply references txin.witness rather than changing code for each call.
| + for (unsigned int i = 0; i < witness.stack.size(); i++) { | ||
| + txinwitness.push_back(HexStr(witness.stack[i].begin(), witness.stack[i].end())); | ||
| + } | ||
| + entry.push_back(Pair("txinwitness", txinwitness)); |
mchrostowski
May 16, 2017
"txinwitness" here seems derived from the variable name, in the context of the entry object it is understood the entry represents a transaction input error, using "witness" instead matches the other entries closer. That is, the error has a "sequence" not a "txinnsequence" or similar.
instagibbs
added some commits
Jul 20, 2016
|
@mchrostowski thanks, that was leftover from previous structure of code. Nits addressed. |
|
utACK 6e9e026 |
instagibbs commentedJul 20, 2016
Makes for easier debugging.