added config observers, delete plaintext blocks when plaintext storage is disabled
This commit is contained in:
parent
2e31155a5d
commit
f78809fa2a
9 changed files with 156 additions and 116 deletions
|
@ -1,9 +1,14 @@
|
|||
'''
|
||||
"""
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
This module works with information relating to blocks stored on the node
|
||||
'''
|
||||
'''
|
||||
"""
|
||||
import sqlite3
|
||||
|
||||
from etc import onionrvalues
|
||||
from . import expiredblocks, updateblockinfo, add
|
||||
from .. import dbfiles
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
|
@ -16,19 +21,16 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
'''
|
||||
import sqlite3
|
||||
|
||||
from etc import onionrvalues
|
||||
from . import expiredblocks, updateblockinfo, add
|
||||
from .. import dbfiles
|
||||
"""
|
||||
|
||||
update_block_info = updateblockinfo.update_block_info
|
||||
add_to_block_DB = add.add_to_block_DB
|
||||
|
||||
|
||||
def get_block_list(dateRec = None, unsaved = False):
|
||||
'''
|
||||
"""
|
||||
Get list of our blocks
|
||||
'''
|
||||
"""
|
||||
if dateRec == None:
|
||||
dateRec = 0
|
||||
|
||||
|
@ -44,10 +46,11 @@ def get_block_list(dateRec = None, unsaved = False):
|
|||
conn.close()
|
||||
return rows
|
||||
|
||||
|
||||
def get_block_date(blockHash):
|
||||
'''
|
||||
"""
|
||||
Returns the date a block was received
|
||||
'''
|
||||
"""
|
||||
|
||||
conn = sqlite3.connect(dbfiles.block_meta_db, timeout=onionrvalues.DATABASE_LOCK_TIMEOUT)
|
||||
c = conn.cursor()
|
||||
|
@ -60,10 +63,11 @@ def get_block_date(blockHash):
|
|||
conn.close()
|
||||
return None
|
||||
|
||||
|
||||
def get_blocks_by_type(blockType, orderDate=True):
|
||||
'''
|
||||
"""
|
||||
Returns a list of blocks by the type
|
||||
'''
|
||||
"""
|
||||
|
||||
conn = sqlite3.connect(dbfiles.block_meta_db, timeout=onionrvalues.DATABASE_LOCK_TIMEOUT)
|
||||
c = conn.cursor()
|
||||
|
@ -80,4 +84,5 @@ def get_blocks_by_type(blockType, orderDate=True):
|
|||
for i in row:
|
||||
rows.append(i)
|
||||
conn.close()
|
||||
return rows
|
||||
return rows
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue