-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Send change path to Ledger so user isn't prompted for change output #3455
Conversation
…t to it. segwit only
1 similar comment
Tested with a p2wpkh-p2sh wallet,
Seems I was too hasty after just a few tests...
So With that change made, cancellation will give
Which is weird as it normally gives 0x6985. (Note: cancellation UX in general should be improved but this is out of scope for the PR) Anyway, this exception is caught and displayed as a pop-up, and is just as descriptive as 0x6985, so might as well leave it. |
plugins/ledger/ledger.py
Outdated
@@ -371,7 +371,11 @@ def sign_transaction(self, tx, password): | |||
if segwitTransaction: | |||
self.get_client().startUntrustedTransaction(True, inputIndex, | |||
chipInputs, redeemScripts[inputIndex]) | |||
outputData = self.get_client().finalizeInputFull(txOutput) | |||
if changePath: | |||
outputData = self.get_client().finalizeInput(output, format_satoshis_plain(outputAmount), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
output
is str
here but btchip-python
expects bytes
. You can import to_bytes
from electrum.util
to convert it. Not sure if it's better to convert here or where its value gets set initially.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
EDIT: see comment below
I've now had another look at Also note that I'm testing with a Nano S, and the mentioned undesired fallback might happen on older Ledgers. |
This way the user can trust based on the Ledger confirmation that change is going to their own address without trusting Electrum on their computer. Currently the change address and amount is prompted as an output.
Only implemented for segwit, since input amounts are signed, guaranteeing that the Ledger prompt represents the total non-change outputs, including fees.