Skip to content

Commit

Permalink
fix bot
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jun 21, 2018
1 parent 6b30f00 commit 265223e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions shuffle/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ def job():
if not pool.get("fool", False)
and pool.get("amount") == amount][0]
if members >= args.limit:
network.start()
# network.start()
sleep(5)
pThread = ProtocolThread(host, port, network, amount, fee, sk, pubk, new_addr, change, logger=logger)
logger.pThread = pThread
pThread.start()
while not is_protocol_done(pThread):
sleep(1)
network.stop()
# network.stop()
pThread.join()
pThread = None
else:
logger.send("Not enough members")
else:
Expand Down Expand Up @@ -73,6 +76,7 @@ def job():
NetworkConstants.set_testnet()
config = SimpleConfig({'server':"bch0.kister.net:51002:s"})
network = Network(config)
network.start()
# setup server
port = args.port
host = args.server
Expand All @@ -83,9 +87,11 @@ def job():
# privkey
priv_key = args.key
sk, pubk = keys_from_priv(priv_key)
print(pubk)
# new address and change
new_addr = args.new_address
change = args.change
from electroncash.address import Address
#Start protocol thread
stat_endpoint = "http://{}:{}/stats".format(host, stat_port)

Expand Down
2 changes: 1 addition & 1 deletion shuffle/coin.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def make_unsigned_transaction(self, amount, fee, inputs, outputs, changes):
tx_changes = [(TYPE_ADDRESS,
Address.from_string(changes[verification_key]),
int(coins[verification_key]['value'] - amount - fee))
for verification_key in changes
for verification_key in sorted(changes)
if Address.is_valid(changes[verification_key])]
transaction.add_outputs(tx_changes)
return transaction
Expand Down

0 comments on commit 265223e

Please sign in to comment.