Skip to content

Commit

Permalink
fix broken dependency on updated bisbasic, which has modules removed …
Browse files Browse the repository at this point in the history
…in favor of bismuthclient (not all)

upgrade connection handling (tested)
  • Loading branch information
hclivess committed Sep 5, 2019
1 parent ab4eec2 commit d5fd5a2
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions send_nogui_noconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,21 @@
from Cryptodome.Hash import SHA
from Cryptodome.Signature import PKCS1_v1_5

from bisbasic import connections, essentials
from bismuthclient import rpcconnections
from bisbasic import essentials, options
from bisbasic.essentials import fee_calculate
import options
from polysign.signerfactory import SignerFactory


def connect():
s = socks.socksocket()
s.settimeout(10)
if 'regnet' in config.version:
s.connect(("127.0.0.1", 3030))
port = 3030
elif 'testnet' in config.version:
s.connect(("127.0.0.1", 2829))
port = 2829
else:
s.connect(("127.0.0.1", 5658))
return s
port = 5658

return rpcconnections.Connection(("127.0.0.1", int(port)))

if __name__ == "__main__":
config = options.Get()
Expand Down Expand Up @@ -66,9 +64,9 @@ def connect():
# get balance

s = connect()
connections.send (s, "balanceget")
connections.send (s, address) # change address here to view other people's transactions
stats_account = connections.receive (s)
s._send ("balanceget")
s._send (address) # change address here to view other people's transactions
stats_account = s._receive()
balance = stats_account[0]

print("Transaction address: %s" % address)
Expand Down Expand Up @@ -115,7 +113,7 @@ def connect():
is_float = 0
sys.exit(1)

timestamp = '%.2f' % time.time()
timestamp = '%.2f' % (time.time() - 5) #remote proofing
# TODO: use transaction object, no dup code for buffer assembling
transaction = (str(timestamp), str(address), str(recipient_input), '%.8f' % float(amount_input), str(operation_input), str(openfield_input)) # this is signed
# TODO: use polysign here
Expand All @@ -141,9 +139,9 @@ def connect():
tx_submit = (str (timestamp), str (address), str (recipient_input), '%.8f' % float (amount_input), str (signature_enc.decode ("utf-8")), str (public_key_b64encoded.decode("utf-8")), str (operation_input), str (openfield_input))
while True:
try:
connections.send (s, "mpinsert")
connections.send (s, tx_submit)
reply = connections.receive (s)
s._send("mpinsert")
s._send (tx_submit)
reply = s._receive()
print ("Client: {}".format (reply))
if reply != "*": # response can be empty due to different timeout setting
break
Expand Down

0 comments on commit d5fd5a2

Please sign in to comment.