use database timeout in hasblock

master
Kevin Froman 2019-10-29 00:44:11 -05:00
parent 304df0fbb4
commit 49ecffb245
1 changed files with 2 additions and 1 deletions

View File

@ -21,12 +21,13 @@ import sqlite3
from coredb import dbfiles from coredb import dbfiles
import onionrexceptions import onionrexceptions
from .. import stringvalidators from .. import stringvalidators
from etc import onionrvalues
def has_block(hash: str) -> bool: def has_block(hash: str) -> bool:
''' '''
Check for new block in the block meta db Check for new block in the block meta db
''' '''
conn = sqlite3.connect(dbfiles.block_meta_db) conn = sqlite3.connect(dbfiles.block_meta_db, timeout=onionrvalues.DATABASE_LOCK_TIMEOUT)
c = conn.cursor() c = conn.cursor()
if not stringvalidators.validate_hash(hash): if not stringvalidators.validate_hash(hash):
raise onionrexceptions.InvalidHexHash("Invalid hash") raise onionrexceptions.InvalidHexHash("Invalid hash")