From 49ecffb245b1d31a32f8998bfa7030ebba5bc2bf Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Tue, 29 Oct 2019 00:44:11 -0500 Subject: [PATCH] use database timeout in hasblock --- onionr/onionrutils/blockmetadata/hasblock.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/onionr/onionrutils/blockmetadata/hasblock.py b/onionr/onionrutils/blockmetadata/hasblock.py index 0e98dcd9..8f4bbb2a 100644 --- a/onionr/onionrutils/blockmetadata/hasblock.py +++ b/onionr/onionrutils/blockmetadata/hasblock.py @@ -21,12 +21,13 @@ import sqlite3 from coredb import dbfiles import onionrexceptions from .. import stringvalidators +from etc import onionrvalues def has_block(hash: str) -> bool: ''' 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() if not stringvalidators.validate_hash(hash): raise onionrexceptions.InvalidHexHash("Invalid hash")