add config option to skip transaction verification
This commit is contained in:
parent
6814f2e38c
commit
dd979f800d
3 changed files with 8 additions and 1 deletions
|
@ -627,6 +627,10 @@ class Config(CLIConfig):
|
||||||
"only disable this if file_x commands are not needed", True
|
"only disable this if file_x commands are not needed", True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
skip_transaction_verification = Toggle(
|
||||||
|
"Enable to skip transaction verification if you trust the wallet server you are connected to", False
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def streaming_host(self):
|
def streaming_host(self):
|
||||||
return self.streaming_server.split(':')[0]
|
return self.streaming_server.split(':')[0]
|
||||||
|
|
|
@ -567,7 +567,7 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
cache_item = self._tx_cache[txid] = TransactionCacheItem()
|
cache_item = self._tx_cache[txid] = TransactionCacheItem()
|
||||||
elif cache_item.tx is not None and \
|
elif cache_item.tx is not None and \
|
||||||
cache_item.tx.height >= remote_height and \
|
cache_item.tx.height >= remote_height and \
|
||||||
(cache_item.tx.is_verified or remote_height < 1):
|
(cache_item.tx.is_verified or self.config.get('skip_transaction_verification') or remote_height < 1):
|
||||||
return cache_item.tx # cached tx is already up-to-date
|
return cache_item.tx # cached tx is already up-to-date
|
||||||
|
|
||||||
async with cache_item.lock:
|
async with cache_item.lock:
|
||||||
|
@ -589,6 +589,8 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
|
|
||||||
async def maybe_verify_transaction(self, tx, remote_height):
|
async def maybe_verify_transaction(self, tx, remote_height):
|
||||||
tx.height = remote_height
|
tx.height = remote_height
|
||||||
|
if self.config.get("skip_transaction_verification"):
|
||||||
|
return
|
||||||
if 0 < remote_height < len(self.headers):
|
if 0 < remote_height < len(self.headers):
|
||||||
merkle = await self.network.retriable_call(self.network.get_merkle, tx.id, remote_height)
|
merkle = await self.network.retriable_call(self.network.get_merkle, tx.id, remote_height)
|
||||||
merkle_root = self.get_root_of_merkle_tree(merkle['merkle'], merkle['pos'], tx.hash)
|
merkle_root = self.get_root_of_merkle_tree(merkle['merkle'], merkle['pos'], tx.hash)
|
||||||
|
|
|
@ -184,6 +184,7 @@ class WalletManager:
|
||||||
'auto_connect': True,
|
'auto_connect': True,
|
||||||
'default_servers': config.lbryum_servers,
|
'default_servers': config.lbryum_servers,
|
||||||
'data_path': config.wallet_dir,
|
'data_path': config.wallet_dir,
|
||||||
|
'skip_transaction_verification': config.skip_transaction_verification,
|
||||||
}
|
}
|
||||||
|
|
||||||
wallets_directory = os.path.join(config.wallet_dir, 'wallets')
|
wallets_directory = os.path.join(config.wallet_dir, 'wallets')
|
||||||
|
|
Loading…
Add table
Reference in a new issue