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.
This commit is contained in:
parent
a3398d6a17
commit
5605672f75
|
@ -1,6 +1,7 @@
|
||||||
import collections
|
import collections
|
||||||
from threading import current_thread, enumerate as threadingEnumerate, RLock
|
from threading import current_thread, enumerate as threadingEnumerate, RLock
|
||||||
import Queue
|
import Queue
|
||||||
|
import sqlite3
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from helper_sql import *
|
from helper_sql import *
|
||||||
|
@ -50,7 +51,7 @@ class SqliteInventory(InventoryStorage):
|
||||||
def by_type_and_tag(self, objectType, tag):
|
def by_type_and_tag(self, objectType, tag):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
values = [value for value in self._inventory.values() if value.type == objectType and value.tag == tag]
|
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
|
return values
|
||||||
|
|
||||||
def hashes_by_stream(self, stream):
|
def hashes_by_stream(self, stream):
|
||||||
|
|
Reference in New Issue
Block a user