Support offline signing coordination (#625)

This commit is contained in:
benk10 2020-11-19 16:59:36 +01:00 committed by GitHub
parent eabe0f4fcd
commit 9183f7f924
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 7 deletions

View file

@ -10,7 +10,7 @@
- [Using the Specter Desktop app](#using-the-specter-desktop-app)
- [Installing Specter from Pip](#installing-specter-from-pip)
- [Connect Specter to Bitcoin Core](#connect-specter-to-bitcoin-core)
- [Detailed instructions](#detailed-instructions)
- [Tips and tricks (detailed instructions)](#tips-and-tricks-detailed-instructions)
- [Errors, doubts.. Read our FAQ!](#errors-doubts-read-our-faq)
- [A few screenshots](#a-few-screenshots)
- [Adding a new device](#adding-a-new-device)

View file

@ -115,6 +115,7 @@
{{ explorer_link('tx', input['txid'], input['txid'], specter.explorer) }}
(Output #{{ input['vout'] }})<br>
{% set tx = wallet.gettransaction(input['txid']) %}
{% if tx %}
<b>Address:</b>
{{ explorer_link('address', tx['details'][0]['address'], tx['details'][0]['address'], specter.explorer) }}
<br>
@ -122,6 +123,7 @@
<b>Label:</b> {{ tx['details'][0]['label'] }}<br>
{% endif %}
<b>Amount:</b> {{ psbt['inputs'][loop.index0]['witness_utxo']['amount'] }} BTC
{% endif %}
</p>
{% endfor %}
<h2 class="tx_details_header">Outputs ({{psbt['tx']['vout']|length}})</h2>

View file

@ -555,7 +555,10 @@ class Wallet:
return sorted(result, key=lambda tx: tx["confirmations"])
def gettransaction(self, txid, blockheight=None):
return self._transactions.gettransaction(txid, blockheight)
try:
return self._transactions.gettransaction(txid, blockheight)
except Exception as e:
logger.warning("Could not get transaction {}, error: {}".format(txid, e))
def rescanutxo(self, explorer=None):
t = threading.Thread(target=self._rescan_utxo_thread, args=(explorer,))
@ -1184,12 +1187,14 @@ class Wallet:
txid = inp.prevout.hash.to_bytes(32, "big").hex()
try:
res = self.gettransaction(txid)
stream = BytesIO(bytes.fromhex(res["hex"]))
prevtx = CTransaction()
prevtx.deserialize(stream)
psbt.inputs[i].non_witness_utxo = prevtx
except:
raise SpecterError("Can't find previous transaction in the wallet.")
stream = BytesIO(bytes.fromhex(res["hex"]))
prevtx = CTransaction()
prevtx.deserialize(stream)
psbt.inputs[i].non_witness_utxo = prevtx
logger.error(
"Can't find previous transaction in the wallet. Signing might not be possible for certain devices..."
)
else:
# remove non_witness_utxo if we don't want them
for inp in psbt.inputs: