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

More user-friendly error message when partially signing #11288

Merged
merged 1 commit into from Sep 26, 2017
Merged

More user-friendly error message when partially signing #11288

merged 1 commit into from Sep 26, 2017

Conversation

meshcollider
Copy link
Contributor

When partially signing a transaction using signrawtransaction, if the wallet doesn't have access to a key, it will output a scary error message "error": "Operation not valid with the current stack size", yet it will partially sign the transaction anyway. This puts a lot of users off, because they don't realise the signing actually succeeded for some inputs. This catches that specific error when signing, and outputs a friendlier message which says Unable to sign input, invalid stack size (possibly missing key).

This is the best way I could think of to fix the issue, but please let me know if you come up with a better way to do it :)

Fixes #9988

Copy link
Member

@promag promag left a comment

Choose a reason for hiding this comment

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

Care to add a test for expected output?

@@ -873,7 +873,13 @@ UniValue signrawtransaction(const JSONRPCRequest& request)

ScriptError serror = SCRIPT_ERR_OK;
if (!VerifyScript(txin.scriptSig, prevPubKey, &txin.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, TransactionSignatureChecker(&txConst, i, amount), &serror)) {
TxInErrorToJSON(txin, vErrors, ScriptErrorString(serror));
if(serror == SCRIPT_ERR_INVALID_STACK_OPERATION) {
// we haven't been able to sign this input and verification failed, could be attempting to partially sign
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

// Unable to sign input and verification failed (possible attempt to partially sign).

// we haven't been able to sign this input and verification failed, could be attempting to partially sign
TxInErrorToJSON(txin, vErrors, "Unable to sign input, invalid stack size (possibly missing key)");
} else {
// some other issue
Copy link
Member

Choose a reason for hiding this comment

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

Nit, remove comment.

@@ -873,7 +873,13 @@ UniValue signrawtransaction(const JSONRPCRequest& request)

ScriptError serror = SCRIPT_ERR_OK;
if (!VerifyScript(txin.scriptSig, prevPubKey, &txin.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, TransactionSignatureChecker(&txConst, i, amount), &serror)) {
TxInErrorToJSON(txin, vErrors, ScriptErrorString(serror));
if(serror == SCRIPT_ERR_INVALID_STACK_OPERATION) {
Copy link
Member

Choose a reason for hiding this comment

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

Missing space after if.

@laanwj
Copy link
Member

laanwj commented Sep 16, 2017

utACK, to me honest this caught me off-guard too the first time I used multi-signed transactions.

@achow101
Copy link
Member

utACK df10edf

@instagibbs
Copy link
Member

utACK df10edf

I've come across this as well too. thanks.

@laanwj laanwj merged commit df10edf into bitcoin:master Sep 26, 2017
laanwj added a commit that referenced this pull request Sep 26, 2017
df10edf More user-friendly error message when partially signing (MeshCollider)

Pull request description:

  When partially signing a transaction using `signrawtransaction`, if the wallet doesn't have access to a key, it will output a scary error message `"error": "Operation not valid with the current stack size"`, yet it will partially sign the transaction anyway. This puts a lot of users off, because they don't realise the signing actually succeeded for some inputs. This catches that specific error when signing, and outputs a friendlier message which says `Unable to sign input, invalid stack size (possibly missing key)`.

  This is the best way I could think of to fix the issue, but please let me know if you come up with a better way to do it :)

  Fixes #9988

Tree-SHA512: 65e1d4a49caa4202e1357b0b3f42329d76456c7b4286d63232226e03267809027b0c44e0faaa1da8b86c9ad677e3a3d655698a24fc870d6a661203c9f56ef95b
@meshcollider meshcollider deleted the 201709_partial_sign_error branch October 13, 2017 21:28
AmirAbrams added a commit to duality-solutions/Dynamic that referenced this pull request Nov 8, 2019
AmirAbrams added a commit to duality-solutions/Dynamic that referenced this pull request Nov 22, 2019
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 22, 2019
…signing

df10edf More user-friendly error message when partially signing (MeshCollider)

Pull request description:

  When partially signing a transaction using `signrawtransaction`, if the wallet doesn't have access to a key, it will output a scary error message `"error": "Operation not valid with the current stack size"`, yet it will partially sign the transaction anyway. This puts a lot of users off, because they don't realise the signing actually succeeded for some inputs. This catches that specific error when signing, and outputs a friendlier message which says `Unable to sign input, invalid stack size (possibly missing key)`.

  This is the best way I could think of to fix the issue, but please let me know if you come up with a better way to do it :)

  Fixes bitcoin#9988

Tree-SHA512: 65e1d4a49caa4202e1357b0b3f42329d76456c7b4286d63232226e03267809027b0c44e0faaa1da8b86c9ad677e3a3d655698a24fc870d6a661203c9f56ef95b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 2, 2020
…signing

df10edf More user-friendly error message when partially signing (MeshCollider)

Pull request description:

  When partially signing a transaction using `signrawtransaction`, if the wallet doesn't have access to a key, it will output a scary error message `"error": "Operation not valid with the current stack size"`, yet it will partially sign the transaction anyway. This puts a lot of users off, because they don't realise the signing actually succeeded for some inputs. This catches that specific error when signing, and outputs a friendlier message which says `Unable to sign input, invalid stack size (possibly missing key)`.

  This is the best way I could think of to fix the issue, but please let me know if you come up with a better way to do it :)

  Fixes bitcoin#9988

Tree-SHA512: 65e1d4a49caa4202e1357b0b3f42329d76456c7b4286d63232226e03267809027b0c44e0faaa1da8b86c9ad677e3a3d655698a24fc870d6a661203c9f56ef95b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 4, 2020
…signing

df10edf More user-friendly error message when partially signing (MeshCollider)

Pull request description:

  When partially signing a transaction using `signrawtransaction`, if the wallet doesn't have access to a key, it will output a scary error message `"error": "Operation not valid with the current stack size"`, yet it will partially sign the transaction anyway. This puts a lot of users off, because they don't realise the signing actually succeeded for some inputs. This catches that specific error when signing, and outputs a friendlier message which says `Unable to sign input, invalid stack size (possibly missing key)`.

  This is the best way I could think of to fix the issue, but please let me know if you come up with a better way to do it :)

  Fixes bitcoin#9988

Tree-SHA512: 65e1d4a49caa4202e1357b0b3f42329d76456c7b4286d63232226e03267809027b0c44e0faaa1da8b86c9ad677e3a3d655698a24fc870d6a661203c9f56ef95b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
…signing

df10edf More user-friendly error message when partially signing (MeshCollider)

Pull request description:

  When partially signing a transaction using `signrawtransaction`, if the wallet doesn't have access to a key, it will output a scary error message `"error": "Operation not valid with the current stack size"`, yet it will partially sign the transaction anyway. This puts a lot of users off, because they don't realise the signing actually succeeded for some inputs. This catches that specific error when signing, and outputs a friendlier message which says `Unable to sign input, invalid stack size (possibly missing key)`.

  This is the best way I could think of to fix the issue, but please let me know if you come up with a better way to do it :)

  Fixes bitcoin#9988

Tree-SHA512: 65e1d4a49caa4202e1357b0b3f42329d76456c7b4286d63232226e03267809027b0c44e0faaa1da8b86c9ad677e3a3d655698a24fc870d6a661203c9f56ef95b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
…signing

df10edf More user-friendly error message when partially signing (MeshCollider)

Pull request description:

  When partially signing a transaction using `signrawtransaction`, if the wallet doesn't have access to a key, it will output a scary error message `"error": "Operation not valid with the current stack size"`, yet it will partially sign the transaction anyway. This puts a lot of users off, because they don't realise the signing actually succeeded for some inputs. This catches that specific error when signing, and outputs a friendlier message which says `Unable to sign input, invalid stack size (possibly missing key)`.

  This is the best way I could think of to fix the issue, but please let me know if you come up with a better way to do it :)

  Fixes bitcoin#9988

Tree-SHA512: 65e1d4a49caa4202e1357b0b3f42329d76456c7b4286d63232226e03267809027b0c44e0faaa1da8b86c9ad677e3a3d655698a24fc870d6a661203c9f56ef95b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
…signing

df10edf More user-friendly error message when partially signing (MeshCollider)

Pull request description:

  When partially signing a transaction using `signrawtransaction`, if the wallet doesn't have access to a key, it will output a scary error message `"error": "Operation not valid with the current stack size"`, yet it will partially sign the transaction anyway. This puts a lot of users off, because they don't realise the signing actually succeeded for some inputs. This catches that specific error when signing, and outputs a friendlier message which says `Unable to sign input, invalid stack size (possibly missing key)`.

  This is the best way I could think of to fix the issue, but please let me know if you come up with a better way to do it :)

  Fixes bitcoin#9988

Tree-SHA512: 65e1d4a49caa4202e1357b0b3f42329d76456c7b4286d63232226e03267809027b0c44e0faaa1da8b86c9ad677e3a3d655698a24fc870d6a661203c9f56ef95b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
…signing

df10edf More user-friendly error message when partially signing (MeshCollider)

Pull request description:

  When partially signing a transaction using `signrawtransaction`, if the wallet doesn't have access to a key, it will output a scary error message `"error": "Operation not valid with the current stack size"`, yet it will partially sign the transaction anyway. This puts a lot of users off, because they don't realise the signing actually succeeded for some inputs. This catches that specific error when signing, and outputs a friendlier message which says `Unable to sign input, invalid stack size (possibly missing key)`.

  This is the best way I could think of to fix the issue, but please let me know if you come up with a better way to do it :)

  Fixes bitcoin#9988

Tree-SHA512: 65e1d4a49caa4202e1357b0b3f42329d76456c7b4286d63232226e03267809027b0c44e0faaa1da8b86c9ad677e3a3d655698a24fc870d6a661203c9f56ef95b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
…signing

df10edf More user-friendly error message when partially signing (MeshCollider)

Pull request description:

  When partially signing a transaction using `signrawtransaction`, if the wallet doesn't have access to a key, it will output a scary error message `"error": "Operation not valid with the current stack size"`, yet it will partially sign the transaction anyway. This puts a lot of users off, because they don't realise the signing actually succeeded for some inputs. This catches that specific error when signing, and outputs a friendlier message which says `Unable to sign input, invalid stack size (possibly missing key)`.

  This is the best way I could think of to fix the issue, but please let me know if you come up with a better way to do it :)

  Fixes bitcoin#9988

Tree-SHA512: 65e1d4a49caa4202e1357b0b3f42329d76456c7b4286d63232226e03267809027b0c44e0faaa1da8b86c9ad677e3a3d655698a24fc870d6a661203c9f56ef95b
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 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.

signrawtransaction shows errors after partially signing a multisig transaction
6 participants