From e7079f1beac9b1e9164e691582e0857daab645b4 Mon Sep 17 00:00:00 2001 From: TheCharlatan Date: Mon, 9 Sep 2019 14:52:59 +0200 Subject: [PATCH] Digital BitBox: Fix sending to self Make sure that a pubkey is only appended to the checkpub array if it corresponds to a change address. Signing will fail otherwise, if a non-change pubkey is sent as part of the checkpub list to the Digital BitBox. --- electrum/plugins/digitalbitbox/digitalbitbox.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/electrum/plugins/digitalbitbox/digitalbitbox.py b/electrum/plugins/digitalbitbox/digitalbitbox.py index 27a2a3876..57a4d1201 100644 --- a/electrum/plugins/digitalbitbox/digitalbitbox.py +++ b/electrum/plugins/digitalbitbox/digitalbitbox.py @@ -570,11 +570,12 @@ class DigitalBitbox_KeyStore(Hardware_KeyStore): assert o.type == TYPE_ADDRESS info = tx.output_info.get(o.address) if info is not None: - index = info.address_index - changePath = self.get_derivation() + "/%d/%d" % index - changePubkey = self.derive_pubkey(index[0], index[1]) - pubkeyarray_i = {'pubkey': changePubkey, 'keypath': changePath} - pubkeyarray.append(pubkeyarray_i) + if info.is_change: + index = info.address_index + changePath = self.get_derivation() + "/%d/%d" % index + changePubkey = self.derive_pubkey(index[0], index[1]) + pubkeyarray_i = {'pubkey': changePubkey, 'keypath': changePath} + pubkeyarray.append(pubkeyarray_i) # Special serialization of the unsigned transaction for # the mobile verification app.