preparescript: Add WALLET_ENCRYPTION_PWD env var.

Removed unnecessary START_DAEMONS env var.
Remove all cached addresses from the basicswap db for a wallet after reseeding.
Check that addresses retreived from the db are owned by teh wallet before they're used/displayed
This commit is contained in:
tecnovert
2022-11-17 00:36:13 +02:00
parent aabf865873
commit 0f7df9e5f1
12 changed files with 189 additions and 57 deletions

View File

@@ -188,6 +188,7 @@ class BTCInterface(CoinInterface):
self._connection_type = coin_settings['connection_type']
self._sc = swap_client
self._log = self._sc.log if self._sc and self._sc.log else logging
self._expect_seedid_hex = None
def using_segwit(self):
return self._use_segwit
@@ -297,6 +298,7 @@ class BTCInterface(CoinInterface):
return self.rpc_callback('getwalletinfo')['hdseedid']
def checkExpectedSeed(self, expect_seedid):
self._expect_seedid_hex = expect_seedid
return expect_seedid == self.getWalletSeedID()
def getNewAddress(self, use_segwit, label='swap_receive'):
@@ -305,6 +307,15 @@ class BTCInterface(CoinInterface):
args.append('bech32')
return self.rpc_callback('getnewaddress', args)
def isAddressMine(self, address):
addr_info = self.rpc_callback('getaddressinfo', [address])
return addr_info['ismine']
def checkAddressMine(self, address):
addr_info = self.rpc_callback('getaddressinfo', [address])
ensure(addr_info['ismine'], 'ismine is false')
ensure(addr_info['hdseedid'] == self._expect_seedid_hex, 'unexpected seedid')
def get_fee_rate(self, conf_target=2):
try:
fee_rate = self.rpc_callback('estimatesmartfee', [conf_target])['feerate']