diff options
Diffstat (limited to 'backend/resilient/bsv_metanet.py')
-rw-r--r-- | backend/resilient/bsv_metanet.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/backend/resilient/bsv_metanet.py b/backend/resilient/bsv_metanet.py index 62bf6c1..98956bb 100644 --- a/backend/resilient/bsv_metanet.py +++ b/backend/resilient/bsv_metanet.py @@ -24,13 +24,18 @@ class bsvup(): with open(self.keyfile) as f: self.privkey = f.read() self.configdir = self.keyfile + '.bsv' if bsvup.found: - if not os.path.isdir(self.configdir): - os.mkdir(self.configdir) + if not os.path.isfile(os.path.join(self.configdir, 'key')): + if os.path.isdir(self.configdir): + os.remove(os.path.join(self.configdir, '.bsv')) + else: + os.mkdir(self.configdir) os.symlink(".", os.path.join(self.configdir, ".bsv")) - proc = subprocess.Popen([bsvup.binary, 'init'], stdin=subprocess.PIPE, cwd=self.configdir) - proc.stdin.write(self.privkey + "\n") - time.sleep(1) - proc.communicate("\n") + proc = subprocess.Popen([bsvup.binary, '-p', '', '-r', '250', 'init'], stdin=subprocess.PIPE, cwd=self.configdir) + result = proc.communicate(self.privkey + "\n"); + print(result[0]) + print(result[1]) + if not os.path.isfile(os.path.join(self.configdir, 'key')): + raise "key not generated" open(os.path.join(self.configdir, "info", ".keepme"), "a").close() open(os.path.join(self.configdir, "objects", ".keepme"), "a").close() open(os.path.join(self.configdir, "tx", ".keepme"), "a").close() @@ -44,7 +49,7 @@ class bsvup(): # add files to bsv metanet orig_dir = os.path.abspath(".") - proc = subprocess.Popen([bsvup.binary, '-f', html_path, 'upload'], stdin=subprocess.PIPE, cwd=self.configdir) + proc = subprocess.Popen([bsvup.binary, '-p', '', '-r', '250', '-f', html_path, 'upload'], stdin=subprocess.PIPE, cwd=self.configdir) proc.stdin.write("\n") time.sleep(1) proc.stdin.write("Y\n") |