ui: Hide all except 'Reseed Wallet' button if expected_seed is false.
This commit is contained in:
parent
eb9eb49bd9
commit
6ae8651d1b
@ -704,7 +704,7 @@ class BasicSwap(BaseApp):
|
|||||||
if synced < 1.0:
|
if synced < 1.0:
|
||||||
raise ValueError('{} chain is still syncing, currently at {}.'.format(self.coin_clients[c]['name'], synced))
|
raise ValueError('{} chain is still syncing, currently at {}.'.format(self.coin_clients[c]['name'], synced))
|
||||||
|
|
||||||
def initialiseWallet(self, coin_type):
|
def initialiseWallet(self, coin_type, raise_errors=False):
|
||||||
if coin_type == Coins.PART:
|
if coin_type == Coins.PART:
|
||||||
return
|
return
|
||||||
ci = self.ci(coin_type)
|
ci = self.ci(coin_type)
|
||||||
@ -722,7 +722,14 @@ class BasicSwap(BaseApp):
|
|||||||
|
|
||||||
root_key = self.getWalletKey(coin_type, 1)
|
root_key = self.getWalletKey(coin_type, 1)
|
||||||
root_hash = ci.getAddressHashFromKey(root_key)[::-1]
|
root_hash = ci.getAddressHashFromKey(root_key)[::-1]
|
||||||
ci.initialiseWallet(root_key)
|
|
||||||
|
try:
|
||||||
|
ci.initialiseWallet(root_key)
|
||||||
|
except Exception as e:
|
||||||
|
# < 0.21: sethdseed cannot set a new HD seed while still in Initial Block Download.
|
||||||
|
self._log.error('initialiseWallet failed: {}'.format(str(e)))
|
||||||
|
if raise_errors:
|
||||||
|
raise e
|
||||||
|
|
||||||
key_str = 'main_wallet_seedid_' + ci.coin_name().lower()
|
key_str = 'main_wallet_seedid_' + ci.coin_name().lower()
|
||||||
self.setStringKV(key_str, root_hash.hex())
|
self.setStringKV(key_str, root_hash.hex())
|
||||||
@ -1499,7 +1506,7 @@ class BasicSwap(BaseApp):
|
|||||||
if ci.knownWalletSeed():
|
if ci.knownWalletSeed():
|
||||||
raise ValueError('{} wallet seed is already derived from the particl mnemonic'.format(ci.coin_name()))
|
raise ValueError('{} wallet seed is already derived from the particl mnemonic'.format(ci.coin_name()))
|
||||||
|
|
||||||
self.initialiseWallet(coin_type)
|
self.initialiseWallet(coin_type, raise_errors=True)
|
||||||
|
|
||||||
# TODO: How to scan pruned blocks?
|
# TODO: How to scan pruned blocks?
|
||||||
|
|
||||||
|
@ -259,11 +259,7 @@ class BTCInterface(CoinInterface):
|
|||||||
def initialiseWallet(self, key_bytes):
|
def initialiseWallet(self, key_bytes):
|
||||||
key_wif = self.encodeKey(key_bytes)
|
key_wif = self.encodeKey(key_bytes)
|
||||||
|
|
||||||
try:
|
self.rpc_callback('sethdseed', [True, key_wif])
|
||||||
self.rpc_callback('sethdseed', [True, key_wif])
|
|
||||||
except Exception as e:
|
|
||||||
# < 0.21: Cannot set a new HD seed while still in Initial Block Download.
|
|
||||||
self._log.error('sethdseed failed: {}'.format(str(e)))
|
|
||||||
|
|
||||||
def getWalletInfo(self):
|
def getWalletInfo(self):
|
||||||
return self.rpc_callback('getwalletinfo')
|
return self.rpc_callback('getwalletinfo')
|
||||||
|
@ -177,7 +177,7 @@
|
|||||||
<td>{{ w.expected_seed }}</td>{% if w.expected_seed != true %}
|
<td>{{ w.expected_seed }}</td>{% if w.expected_seed != true %}
|
||||||
<td>
|
<td>
|
||||||
<input class="appearance-none bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block p-2.5" type="submit" name="reseed_{{ w.cid }}" value="Reseed wallet" onclick="return confirmReseed();">
|
<input class="appearance-none bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block p-2.5" type="submit" name="reseed_{{ w.cid }}" value="Reseed wallet" onclick="return confirmReseed();">
|
||||||
</td>{% endif %}
|
</td> </tr></table> {% else %}
|
||||||
</tr> {% if w.cid == '1' %}
|
</tr> {% if w.cid == '1' %}
|
||||||
<tr class="bg-white border-t hover:bg-gray-50">
|
<tr class="bg-white border-t hover:bg-gray-50">
|
||||||
<td class="py-4 px-6 bold">Stealth Address</td>
|
<td class="py-4 px-6 bold">Stealth Address</td>
|
||||||
@ -317,7 +317,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> {% endif %} {% endif %} {% endif %} {% endif %}
|
</div> {% endif %} {% endif %} {% endif %} {% endif %} {% endif %}
|
||||||
<!-- havedata -->
|
<!-- havedata -->
|
||||||
<input type="hidden" name="formid" value="{{ form_id }}">
|
<input type="hidden" name="formid" value="{{ form_id }}">
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user