use database timeout in hasblock
parent
304df0fbb4
commit
49ecffb245
|
@ -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")
|
||||||
|
|
Loading…
Reference in New Issue