From 5605672f753162a82eb7651f3dc3d20d0502ec20 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Sat, 2 Dec 2017 02:48:10 +0100 Subject: [PATCH] Fix tag search when inventory contains blobs - recent changes caused the "tag" (and "payload") columns in the inventory table in messages.dat to be stored as blobs. Searches by tag (e.g. pubkey lookups) stopped working. This fixes it. --- src/storage/sqlite.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/storage/sqlite.py b/src/storage/sqlite.py index aba64244..7c9e8822 100644 --- a/src/storage/sqlite.py +++ b/src/storage/sqlite.py @@ -1,6 +1,7 @@ import collections from threading import current_thread, enumerate as threadingEnumerate, RLock import Queue +import sqlite3 import time from helper_sql import * @@ -50,7 +51,7 @@ class SqliteInventory(InventoryStorage): def by_type_and_tag(self, objectType, tag): with self.lock: values = [value for value in self._inventory.values() if value.type == objectType and value.tag == tag] - values += (InventoryItem(*value) for value in sqlQuery('SELECT objecttype, streamnumber, payload, expirestime, tag FROM inventory WHERE objecttype=? AND tag=?', objectType, tag)) + values += (InventoryItem(*value) for value in sqlQuery('SELECT objecttype, streamnumber, payload, expirestime, tag FROM inventory WHERE objecttype=? AND tag=?', objectType, sqlite3.Binary(tag))) return values def hashes_by_stream(self, stream):