diff --git a/jmclient/jmclient/cryptoengine.py b/jmclient/jmclient/cryptoengine.py index 9262d3b..1f577a0 100644 --- a/jmclient/jmclient/cryptoengine.py +++ b/jmclient/jmclient/cryptoengine.py @@ -115,6 +115,10 @@ class BTCEngine(object): @classmethod def wif_to_privkey(cls, wif): + """ Note July 2020: the `key_type` construction below is + custom and is not currently used. Future code should + not use this returned `key_type` variable. + """ raw = btc.b58check_to_bin(wif)[1] # see note to `privkey_to_wif`; same applies here. # We only handle valid private keys, not any byte string. diff --git a/scripts/add-utxo.py b/scripts/add-utxo.py index 0b7bbc7..f39efc5 100755 --- a/scripts/add-utxo.py +++ b/scripts/add-utxo.py @@ -31,9 +31,9 @@ def add_ext_commitments(utxo_datas): This calls the underlying 'raw' code based on the class PoDLE, not the library 'generate_podle' which intelligently searches and updates commitments. """ - #Convert priv from wif; require P2SH-P2WPKH keys - rawpriv, keytype = BTCEngine.wif_to_privkey(priv) - assert keytype == BTC_P2SH_P2WPKH + # Convert priv from wif; note that wallet type + # isn't relevant since we only work with pubkeys in PoDLE: + rawpriv, _ = BTCEngine.wif_to_privkey(priv) podle = PoDLE(u, rawpriv) r = podle.generate_podle(i) return (r['P'], r['P2'], r['sig'], diff --git a/scripts/joinmarket-qt.py b/scripts/joinmarket-qt.py index 6e5a453..35a6103 100755 --- a/scripts/joinmarket-qt.py +++ b/scripts/joinmarket-qt.py @@ -1581,13 +1581,8 @@ class JMMainWindow(QMainWindow): with open(os.path.join(jm_single().datadir, privkeys_fn + '.json'), "wb") as f: for addr, pk in private_keys.items(): - #sanity check - rawpriv, keytype = BTCEngine.wif_to_privkey(pk) - if not keytype == BTC_P2SH_P2WPKH: - JMQtMessageBox(None, "Failed to create privkey export, " - "should be keytype p2sh-p2wpkh but is not.", - mbtype='crit') - return + # sanity check + rawpriv, _ = BTCEngine.wif_to_privkey(pk) if not addr == self.wallet_service._ENGINE.privkey_to_address(rawpriv): JMQtMessageBox(None, "Failed to create privkey export -" +\ " critical error in key parsing.",