Inventory flush fix in GUI

- Fixes #1011
This commit is contained in:
Peter Šurda 2017-06-10 10:10:59 +02:00
parent 7e8ee51322
commit 7f06cb7c27
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -77,7 +77,7 @@ from class_objectHashHolder import objectHashHolder
from class_singleWorker import singleWorker from class_singleWorker import singleWorker
from dialogs import AddAddressDialog from dialogs import AddAddressDialog
from helper_generic import powQueueSize from helper_generic import powQueueSize
from inventory import PendingDownloadQueue, PendingUpload, PendingUploadDeadlineException from inventory import Inventory, PendingDownloadQueue, PendingUpload, PendingUploadDeadlineException
import knownnodes import knownnodes
import paths import paths
from proofofwork import getPowType from proofofwork import getPowType
@ -2324,11 +2324,11 @@ class MyForm(settingsmixin.SMainWindow):
# in the objectProcessorQueue to be processed # in the objectProcessorQueue to be processed
if self.NewSubscriptionDialogInstance.ui.checkBoxDisplayMessagesAlreadyInInventory.isChecked(): if self.NewSubscriptionDialogInstance.ui.checkBoxDisplayMessagesAlreadyInInventory.isChecked():
status, addressVersion, streamNumber, ripe = decodeAddress(address) status, addressVersion, streamNumber, ripe = decodeAddress(address)
shared.inventory.flush() Inventory().flush()
doubleHashOfAddressData = hashlib.sha512(hashlib.sha512(encodeVarint( doubleHashOfAddressData = hashlib.sha512(hashlib.sha512(encodeVarint(
addressVersion) + encodeVarint(streamNumber) + ripe).digest()).digest() addressVersion) + encodeVarint(streamNumber) + ripe).digest()).digest()
tag = doubleHashOfAddressData[32:] tag = doubleHashOfAddressData[32:]
for value in shared.inventory.by_type_and_tag(3, tag): for value in Inventory().by_type_and_tag(3, tag):
queues.objectProcessorQueue.put((value.type, value.payload)) queues.objectProcessorQueue.put((value.type, value.payload))
def click_pushButtonStatusIcon(self): def click_pushButtonStatusIcon(self):
@ -4398,11 +4398,11 @@ class NewSubscriptionDialog(QtGui.QDialog):
self.ui.checkBoxDisplayMessagesAlreadyInInventory.setText( self.ui.checkBoxDisplayMessagesAlreadyInInventory.setText(
_translate("MainWindow", "Address is an old type. We cannot display its past broadcasts.")) _translate("MainWindow", "Address is an old type. We cannot display its past broadcasts."))
else: else:
shared.inventory.flush() Inventory().flush()
doubleHashOfAddressData = hashlib.sha512(hashlib.sha512(encodeVarint( doubleHashOfAddressData = hashlib.sha512(hashlib.sha512(encodeVarint(
addressVersion) + encodeVarint(streamNumber) + ripe).digest()).digest() addressVersion) + encodeVarint(streamNumber) + ripe).digest()).digest()
tag = doubleHashOfAddressData[32:] tag = doubleHashOfAddressData[32:]
count = len(shared.inventory.by_type_and_tag(3, tag)) count = len(Inventory().by_type_and_tag(3, tag))
if count == 0: if count == 0:
self.ui.checkBoxDisplayMessagesAlreadyInInventory.setText( self.ui.checkBoxDisplayMessagesAlreadyInInventory.setText(
_translate("MainWindow", "There are no recent broadcasts from this address to display.")) _translate("MainWindow", "There are no recent broadcasts from this address to display."))