work on contact manager
This commit is contained in:
parent
e2e8513cf8
commit
0f957f8c5d
@ -244,7 +244,6 @@ class POW:
|
|||||||
self.reporting = reporting
|
self.reporting = reporting
|
||||||
iFound = False # if current thread is the one that found the answer
|
iFound = False # if current thread is the one that found the answer
|
||||||
answer = ''
|
answer = ''
|
||||||
heartbeat = 200000
|
|
||||||
hbCount = 0
|
hbCount = 0
|
||||||
nonce = int(binascii.hexlify(nacl.utils.random(2)), 16)
|
nonce = int(binascii.hexlify(nacl.utils.random(2)), 16)
|
||||||
while self.hashing:
|
while self.hashing:
|
||||||
|
@ -17,10 +17,23 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
|
import os, json
|
||||||
import onionrusers
|
from onionrusers import onionrusers
|
||||||
|
|
||||||
class ContactManager(onionrusers.OnionrUser):
|
class ContactManager(onionrusers.OnionrUser):
|
||||||
|
def __init__(self, coreInst, publicKey, saveUser=False):
|
||||||
|
super(ContactManager, self).__init__(coreInst, publicKey, saveUser=saveUser)
|
||||||
|
self.data = {}
|
||||||
|
self.dataDir = coreInst.dataDir + '/contacts/'
|
||||||
|
self.dataFile = coreInst.dataFile = publicKey + '.json'
|
||||||
|
if not os.path.exists(self.dataFile):
|
||||||
|
os.mkdir(self.dataDir)
|
||||||
|
|
||||||
|
def _writeData(self):
|
||||||
|
data = json.dumps(self.data)
|
||||||
|
with open(self.dataFile, 'w') as dataFile:
|
||||||
|
dataFile.write(data)
|
||||||
|
|
||||||
def set_info(self, key, value):
|
def set_info(self, key, value):
|
||||||
return
|
return
|
||||||
def add_contact(self):
|
def add_contact(self):
|
||||||
|
@ -14,6 +14,6 @@ c = core.Core()
|
|||||||
class OnionrBlockTests(unittest.TestCase):
|
class OnionrBlockTests(unittest.TestCase):
|
||||||
def test_plaintext_insert(self):
|
def test_plaintext_insert(self):
|
||||||
message = 'hello world'
|
message = 'hello world'
|
||||||
c.insertBlock(message)
|
#c.insertBlock(message)
|
||||||
|
|
||||||
unittest.main()
|
unittest.main()
|
Loading…
Reference in New Issue
Block a user