Skip to content

Conversation

instagibbs
Copy link
Member

Makes for easier debugging.

@mcelrath
Copy link

Tested ACK

Works fine with signrawtransaction that fails to fully sign the transaction. (empty witness)

@NicolasDorier
Copy link
Contributor

utACK 73c5eb18e64c7071bfba45029264effccbef3cf3

@laanwj
Copy link
Member

laanwj commented Aug 3, 2016

Does this need to be tested in the RPC tests?

@instagibbs
Copy link
Member Author

@laanwj added basic test check for new field

luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
Github-Pull: bitcoin#8384
Rebased-From: 73c5eb18e64c7071bfba45029264effccbef3cf3
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
Github-Pull: bitcoin#8384
Rebased-From: 464c826d825e0e5c71a4e05fdc169184d9903abf
@jtimon
Copy link
Contributor

jtimon commented Jan 25, 2017

utACK 34bbc0d Needs rebase.

@instagibbs
Copy link
Member Author

Rebased

@instagibbs instagibbs force-pushed the txinerr branch 2 times, most recently from af0b15e to cb70b74 Compare January 25, 2017 20:51
@laanwj
Copy link
Member

laanwj commented Jan 26, 2017

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)
Copy link
Member

Choose a reason for hiding this comment

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

Pass CScriptWitness by reference?

@jtimon
Copy link
Contributor

jtimon commented Feb 3, 2017

ACK squashing b69789a into ef8726c

@jtimon
Copy link
Contributor

jtimon commented Feb 18, 2017

Squash?

@instagibbs
Copy link
Member Author

squashed

@instagibbs
Copy link
Member Author

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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

@instagibbs instagibbs force-pushed the txinerr branch 3 times, most recently from 41a0ec0 to a3ba1cf Compare March 3, 2017 23:43
@instagibbs
Copy link
Member Author

@jnewbery you're right, bad rebase. Sorry for not being careful. Check isn't even needed.

Copy link
Contributor

@mchrostowski mchrostowski left a comment

Choose a reason for hiding this comment

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

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

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));
Copy link
Contributor

Choose a reason for hiding this comment

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

"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
Copy link
Member Author

@mchrostowski thanks, that was leftover from previous structure of code. Nits addressed.

@sipa
Copy link
Member

sipa commented May 17, 2017

utACK 6e9e026

@sipa sipa merged commit 6e9e026 into bitcoin:master May 18, 2017
sipa added a commit that referenced this pull request May 18, 2017
6e9e026 Expand signrawtransaction.py to cover error witness checking (Gregory Sanders)
9f7341b Add witness data output to TxInError messages (Gregory Sanders)

Tree-SHA512: 6f2a758544fa2657f3a57051bdb80fb14cb10501c8ef4ccbab7a62d4b6a823e74f40991c8796248865def24619b620b859dc2bb08dc2cc72511c1cf3897ab1a9
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 15, 2017
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 15, 2017
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants