work on contact manager

master
Kevin Froman 2019-02-17 00:21:29 -06:00
parent e2e8513cf8
commit 0f957f8c5d
3 changed files with 16 additions and 4 deletions

View File

@ -244,7 +244,6 @@ class POW:
self.reporting = reporting
iFound = False # if current thread is the one that found the answer
answer = ''
heartbeat = 200000
hbCount = 0
nonce = int(binascii.hexlify(nacl.utils.random(2)), 16)
while self.hashing:

View File

@ -17,10 +17,23 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import onionrusers
import os, json
from onionrusers import onionrusers
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):
return
def add_contact(self):

View File

@ -14,6 +14,6 @@ c = core.Core()
class OnionrBlockTests(unittest.TestCase):
def test_plaintext_insert(self):
message = 'hello world'
c.insertBlock(message)
#c.insertBlock(message)
unittest.main()