progress in removing core

This commit is contained in:
Kevin Froman 2019-07-20 16:21:03 -05:00
parent e7c8c93dab
commit f843ccc3b2
3 changed files with 8 additions and 6 deletions

View File

@ -20,6 +20,7 @@
import sqlite3 import sqlite3
from . import expiredblocks, updateblockinfo, add from . import expiredblocks, updateblockinfo, add
from .. import dbfiles from .. import dbfiles
update_block_info = updateblockinfo.update_block_info
def get_block_list(dateRec = None, unsaved = False): def get_block_list(dateRec = None, unsaved = False):
''' '''
Get list of our blocks Get list of our blocks

View File

@ -124,7 +124,7 @@ def insert_block(data, header='txt', sign=False, encryptType='', symKey='', asym
payload = onionrproofs.POW(metadata, data).waitForResult() payload = onionrproofs.POW(metadata, data).waitForResult()
if payload != False: if payload != False:
try: try:
retData = onionrstorage.setdata.set_data(data) retData = onionrstorage.setdata.set_data(payload)
except onionrexceptions.DiskAllocationReached: except onionrexceptions.DiskAllocationReached:
logger.error(allocationReachedMessage) logger.error(allocationReachedMessage)
retData = False retData = False

View File

@ -22,7 +22,7 @@
import threading, time, locale, sys, os import threading, time, locale, sys, os
from onionrblockapi import Block from onionrblockapi import Block
import logger, config, onionrblocks import logger, config, onionrblocks
from onionrutils import escapeansi, epoch from onionrutils import escapeansi, epoch, bytesconverter
locale.setlocale(locale.LC_ALL, '') locale.setlocale(locale.LC_ALL, '')
from coredb import blockmetadb from coredb import blockmetadb
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__))) sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
@ -73,10 +73,11 @@ class OnionrFlow:
try: try:
while self.flowRunning: while self.flowRunning:
for block in blockmetadb.get_blocks_by_type('txt'): for block in blockmetadb.get_blocks_by_type('txt'):
block = Block(block) if block in self.alreadyOutputed:
if block.getMetadata('ch') != self.channel:
continue continue
if block.getHash() in self.alreadyOutputed: block = Block(block)
b_hash = bytesconverter.bytes_to_str(block.getHash())
if block.getMetadata('ch') != self.channel:
continue continue
if not self.flowRunning: if not self.flowRunning:
break break
@ -85,7 +86,7 @@ class OnionrFlow:
# Escape new lines, remove trailing whitespace, and escape ansi sequences # Escape new lines, remove trailing whitespace, and escape ansi sequences
content = escapeansi.escape_ANSI(content.replace('\n', '\\n').replace('\r', '\\r').strip()) content = escapeansi.escape_ANSI(content.replace('\n', '\\n').replace('\r', '\\r').strip())
logger.info(block.getDate().strftime("%m/%d %H:%M") + ' - ' + logger.colors.reset + content, prompt = False, terminal=True) logger.info(block.getDate().strftime("%m/%d %H:%M") + ' - ' + logger.colors.reset + content, prompt = False, terminal=True)
self.alreadyOutputed.append(block.getHash()) self.alreadyOutputed.append(b_hash)
time.sleep(5) time.sleep(5)
except KeyboardInterrupt: except KeyboardInterrupt:
self.flowRunning = False self.flowRunning = False