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

fix fill_psbt #1050

Merged
merged 3 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
<div id="signing_container" class="signing_container flex-column {% if psbt['raw'] %}hidden{% endif %}" style="text-align: center;">
<p style="margin-bottom: 15px; margin-top: 0px;">Sign transaction with your:</p>
{% for device in wallet.devices %}
<button type="button" class="btn signing-column-btn" id="{{ device.alias }}_tx_sign_btn" {{ 'disabled style="background-color:#303c49;"' if device.alias in psbt["devices_signed"] else '' }}>
<button type="button" class="btn signing-column-btn" id="{{ device.alias }}_tx_sign_btn" {{ 'disabled style=background-color:#303c49;' if device.alias in psbt["devices_signed"] else '' }}>
{{ device.name }} {% if device.alias in psbt['devices_signed'] %} (&#10004;) {% endif %}
</button>
{% endfor %}
Expand Down
15 changes: 8 additions & 7 deletions src/cryptoadvance/specter/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from .key import Key
from .util.merkleblock import is_valid_merkle_proof
from .helpers import der_to_bytes
from embit import base58
from embit import base58, bip32
from .util.descriptor import Descriptor, sort_descriptor, AddChecksum
from .util.xpub import get_xpub_fingerprint
from .util.tx import decoderawtransaction
from .persistence import write_json_file, delete_file
from hwilib.tx import CTransaction
from hwilib.psbt import PSBT
from hwilib.psbt import PSBT, KeyOriginInfo
from io import BytesIO
from .specter_error import SpecterError
import threading
Expand Down Expand Up @@ -1512,17 +1512,18 @@ def fill_psbt(self, b64psbt, non_witness: bool = True, xpubs: bool = True):
# for multisig add xpub fields
if len(self.keys) > 1:
for k in self.keys:
key = b"\x01" + base58.decode_check(k.xpub)
key = base58.decode_check(k.xpub)
if k.fingerprint != "":
fingerprint = bytes.fromhex(k.fingerprint)
else:
fingerprint = get_xpub_fingerprint(k.xpub)
if k.derivation != "":
der = der_to_bytes(k.derivation)
der = bip32.parse_path(k.derivation)
else:
der = b""
value = fingerprint + der
psbt.unknown[key] = value
der = []
psbt.xpub[key] = KeyOriginInfo(fingerprint, der)
else:
psbt.xpub = {}
return psbt.serialize()

def get_signed_devices(self, decodedpsbt):
Expand Down