fixed pubkey exchange hopefully

master
Kevin Froman 2018-04-03 20:54:49 -05:00
parent 9ecd87595b
commit 2071def07b
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
2 changed files with 20 additions and 11 deletions

View File

@ -67,6 +67,16 @@ class Core:
conn = sqlite3.connect(self.peerDB) conn = sqlite3.connect(self.peerDB)
c = conn.cursor() c = conn.cursor()
t = (peerID, name, 'unknown') t = (peerID, name, 'unknown')
for i in c.execute("SELECT * FROM PEERS where id = '" + peerID + "';"):
try:
if i[0] == peerID:
conn.close()
return False
except ValueError:
pass
except IndexError:
pass
c.execute('INSERT INTO peers (id, name, dateSeen) VALUES(?, ?, ?);', t) c.execute('INSERT INTO peers (id, name, dateSeen) VALUES(?, ?, ?);', t)
conn.commit() conn.commit()
conn.close() conn.close()
@ -361,8 +371,8 @@ class Core:
peerList = [] peerList = []
for i in c.execute(payload): for i in c.execute(payload):
try: try:
if len(i[2]) != 0: if len(i[0]) != 0:
peerList.append(i[2]) peerList.append(i[0])
except TypeError: except TypeError:
pass pass
peerList.append(self._crypto.pubKey) peerList.append(self._crypto.pubKey)
@ -375,18 +385,17 @@ class Core:
id text 0 id text 0
name text, 1 name text, 1
pubkey text, 2 adders text, 2
adders text, 3 forwardKey text, 3
forwardKey text, 4 dateSeen not null, 4
dateSeen not null, 5 bytesStored int, 5
bytesStored int, 6 trust int 6
trust int 7 pubkeyExchanged int 7
pubkeyExchanged int 8
''' '''
conn = sqlite3.connect(self.peerDB) conn = sqlite3.connect(self.peerDB)
c = conn.cursor() c = conn.cursor()
command = (peer,) command = (peer,)
infoNumbers = {'id': 0, 'name': 1, 'pubkey': 2, 'adders': 3, 'forwardKey': 4, 'dateSeen': 5, 'bytesStored': 6, 'trust': 7, 'pubkeyExchanged': 8} infoNumbers = {'id': 0, 'name': 1, 'adders': 2, 'forwardKey': 3, 'dateSeen': 4, 'bytesStored': 5, 'trust': 6, 'pubkeyExchanged': 7}
info = infoNumbers[info] info = infoNumbers[info]
iterCount = 0 iterCount = 0
retVal = '' retVal = ''

View File

@ -42,7 +42,7 @@ class OnionrUtils:
forwardKey = self._core.getPeerInfo(pubkey, 'forwardKey') forwardKey = self._core.getPeerInfo(pubkey, 'forwardKey')
if self._core.getPeerInfo(pubkey, 'pubkeyExchanged'): if self._core.getPeerInfo(pubkey, 'pubkeyExchanged') == 1:
pass pass
if len(forwardKey) > 0: if len(forwardKey) > 0: