From 915107d6516bb22e6022c8d6eb9e64e0d2af17bb Mon Sep 17 00:00:00 2001
From: Holger <holger@nahrstaedt.de>
Date: Fri, 4 Jan 2019 22:24:50 +0100
Subject: [PATCH] Disable not working nodes and improve beempy sign and
 broadcast

* Improve file reading for beempy sign and broadcast
* add option to write file for beempy sign
---
 beem/cli.py                 | 19 ++++++++++++++++---
 beem/nodelist.py            |  8 ++++----
 beem/version.py             |  2 +-
 beemapi/version.py          |  2 +-
 beembase/version.py         |  2 +-
 beemgraphenebase/version.py |  2 +-
 setup.py                    |  2 +-
 7 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/beem/cli.py b/beem/cli.py
index cff74381..8b22d473 100644
--- a/beem/cli.py
+++ b/beem/cli.py
@@ -1670,23 +1670,33 @@ def disapprovewitness(witness, account):
 
 
 @cli.command()
-@click.option('--file', help='Load transaction from file. If "-", read from stdin (defaults to "-")')
-def sign(file):
+@click.option('--file', '-i', help='Load transaction from file. If "-", read from stdin (defaults to "-")')
+@click.option('--outfile', '-o', help='Load transaction from file. If "-", read from stdin (defaults to "-")')
+def sign(file, outfile):
     """Sign a provided transaction with available and required keys"""
     stm = shared_steem_instance()
     if stm.rpc is not None:
         stm.rpc.rpcconnect()
+    if not unlock_wallet(stm):
+        return
     if file and file != "-":
         if not os.path.isfile(file):
             raise Exception("File %s does not exist!" % file)
         with open(file) as fp:
             tx = fp.read()
+        if tx.find('\0') > 0:
+            with open(file, encoding='utf-16') as fp:
+                tx = fp.read()
     else:
         tx = click.get_text_stream('stdin')
     tx = ast.literal_eval(tx)
     tx = stm.sign(tx)
     tx = json.dumps(tx, indent=4)
-    print(tx)
+    if outfile and outfile != "-":
+        with open(outfile, 'w') as fp:
+            fp.write(tx)
+    else:
+        print(tx)
 
 
 @cli.command()
@@ -1701,6 +1711,9 @@ def broadcast(file):
             raise Exception("File %s does not exist!" % file)
         with open(file) as fp:
             tx = fp.read()
+        if tx.find('\0') > 0:
+            with open(file, encoding='utf-16') as fp:
+                tx = fp.read()
     else:
         tx = click.get_text_stream('stdin')
     tx = ast.literal_eval(tx)
diff --git a/beem/nodelist.py b/beem/nodelist.py
index bb130b22..9b18e8da 100644
--- a/beem/nodelist.py
+++ b/beem/nodelist.py
@@ -122,7 +122,7 @@ class NodeList(list):
                 "version": "0.20.2",
                 "type": "appbase",
                 "owner": "themarkymark",
-                "score": 20
+                "score": -20
             },
             {
                 "url": "wss://gtg.steem.house:8090",
@@ -213,7 +213,7 @@ class NodeList(list):
                 "version": "0.20.6",
                 "type": "appbase",
                 "owner": "anyx",
-                "score": 50
+                "score": -10
             },
             {
                 "url": "https://anyx.io",
@@ -227,14 +227,14 @@ class NodeList(list):
                 "version": "0.20.2",
                 "type": "appbase",
                 "owner": "curie",
-                "score": -10
+                "score": 50
             },
             {
                 "url": "wss://rpc.curiesteem.com",
                 "version": "0.20.2",
                 "type": "appbase",
                 "owner": "curie",
-                "score": 50
+                "score": -10
             },
             {
                 "url": "wss://testnet.steem.vc",
diff --git a/beem/version.py b/beem/version.py
index 1d6978c5..6bb54fce 100644
--- a/beem/version.py
+++ b/beem/version.py
@@ -1,2 +1,2 @@
 """THIS FILE IS GENERATED FROM beem SETUP.PY."""
-version = '0.20.14'
+version = '0.20.15'
diff --git a/beemapi/version.py b/beemapi/version.py
index 1d6978c5..6bb54fce 100644
--- a/beemapi/version.py
+++ b/beemapi/version.py
@@ -1,2 +1,2 @@
 """THIS FILE IS GENERATED FROM beem SETUP.PY."""
-version = '0.20.14'
+version = '0.20.15'
diff --git a/beembase/version.py b/beembase/version.py
index 1d6978c5..6bb54fce 100644
--- a/beembase/version.py
+++ b/beembase/version.py
@@ -1,2 +1,2 @@
 """THIS FILE IS GENERATED FROM beem SETUP.PY."""
-version = '0.20.14'
+version = '0.20.15'
diff --git a/beemgraphenebase/version.py b/beemgraphenebase/version.py
index 1d6978c5..6bb54fce 100644
--- a/beemgraphenebase/version.py
+++ b/beemgraphenebase/version.py
@@ -1,2 +1,2 @@
 """THIS FILE IS GENERATED FROM beem SETUP.PY."""
-version = '0.20.14'
+version = '0.20.15'
diff --git a/setup.py b/setup.py
index bf4b9c79..5283ab2a 100755
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ except LookupError:
     ascii = codecs.lookup('ascii')
     codecs.register(lambda name, enc=ascii: {True: enc}.get(name == 'mbcs'))
 
-VERSION = '0.20.14'
+VERSION = '0.20.15'
 
 tests_require = ['mock >= 2.0.0', 'pytest', 'pytest-mock', 'parameterized']
 
-- 
GitLab