Remove unnecessary

This commit is contained in:
Jay Graber 2017-08-01 15:33:49 -07:00
parent b80f4fb0aa
commit ada62d25fa
6 changed files with 11 additions and 17 deletions

View File

@ -91,9 +91,7 @@ def checkBuyStatus(tradeid):
# else:
# print("Compiled p2sh for htlc does not match what seller sent.")
elif status == 'sellerRedeemed':
redeem_tx = find_redeem_tx(trade.buy.currency, trade.buy.p2sh)
trade.buy.redeem_tx = redeem_tx
secret = parse_secret(trade.buy.currency, redeem_tx)
secret = parse_secret(trade.buy.currency, trade.buy.redeem_tx)
if secret != None:
print("Found secret", secret)
txs = auto_redeem_p2sh(trade.sell, secret)

View File

@ -7,12 +7,6 @@ from xcat.utils import *
from xcat.trades import Contract, Trade
import xcat.userInput as userInput
def find_redeem_tx (currency, p2sh):
if currency == 'bitcoin':
bitcoinRPC.find_transaction_to_address(p2sh)
else:
zcashRPC.find_transaction_to_address(p2sh)
def import_addrs(trade):
check_fund_status(trade.sell.currency, trade.sell.p2sh)
check_fund_status(trade.buy.currency, trade.buy.p2sh)
@ -192,7 +186,7 @@ def seller_init(trade):
save_secret(secret)
hash_of_secret = sha256(secret)
# TODO: Implement locktimes and mock block passage of time
sell_locktime = 5
sell_locktime = 20
buy_locktime = 10 # Must be more than first tx
print("Creating pay-to-script-hash for sell contract...")
create_sell_p2sh(trade, hash_of_secret, sell_locktime)

View File

@ -1 +1 @@
secret
secret

View File

@ -15,10 +15,10 @@ def get_trade_amounts():
buy_currency = 'bitcoin'
print(sell_currency)
sell_amt = input("How much {0} do you want to sell? ".format(sell_currency))
sell_amt = 0.1
sell_amt = 0.01
print(sell_amt)
buy_amt = input("How much {0} do you want to receive in exchange? ".format(buy_currency))
buy_amt = 0.2
buy_amt = 0.02
print(buy_amt)
sell = {'currency': sell_currency, 'amount': sell_amt}
buy = {'currency': buy_currency, 'amount': buy_amt}
@ -64,13 +64,15 @@ def get_fulfiller_addresses():
# btc_addr = bXcat.new_bitcoin_addr()
# btc_addr = 'mgRG44X4PQC1ZCA4V654UZjJGJ3pxbApj2' # testnet
# btc_addr = "mvc56qCEVj6p57xZ5URNC3v7qbatudHQ9b"
btc_addr = "mpFD3Knp5znDKAHyiYdXMGEYvxmShjdwSS"
# btc_addr = "mpFD3Knp5znDKAHyiYdXMGEYvxmShjdwSS" # server
btc_addr = 'mtRrCpixF7EvScmoeym3iY9dQeaMFyNGS2'
print(btc_addr)
zec_addr = input("Enter the zcash address of the party you want to trade with: ")
# zec_addr = zXcat.new_zcash_addr()
# zec_addr = 'tmLZu7MdjNdA6vbPTNTwdsZo91LnnrVTYB5' #testnet
# zec_addr = "tmTF7LMLjvEsGdcepWPUsh4vgJNrKMWwEyc"
zec_addr = "tmEGtCab8BJWq3fUa7TK4qhWuY9Ab7SHRh2"
# zec_addr = "tmEGtCab8BJWq3fUa7TK4qhWuY9Ab7SHRh2" #server
zec_addr = 'tmYak55ijTBrx83oBnp9RHmqPZSp1uTnA61' # ariel
print(zec_addr)
addresses = {'bitcoin': btc_addr, 'zcash': zec_addr}
return addresses

View File

@ -56,7 +56,7 @@ def is_myaddr(address):
else:
status = zcashRPC.validateaddress(address)
status = status['ismine']
print("Address {0} is mine: {1}".format(address, status))
# print("Address {0} is mine: {1}".format(address, status))
return status
############################################

View File

@ -1 +1 @@
{"commitment": "2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b", "buy": {"redeemblocknum": 116161, "fulfiller": "tmEGtCab8BJWq3fUa7TK4qhWuY9Ab7SHRh2", "fund_tx": "e55390c7fa36725ea4458b9eb7a1b82850b9f2767362157508d1d8c39276b855:0", "redeem_tx": "9c3a1a7f2f83520f171329ce66272374818f5c0c8d933c227e652c48ded6f3ad", "currency": "zcash", "p2sh": "t27L54EpLd46CNx9heBhoWt7G2UozLRHhcH", "initiator": "tmMuMqAD83idRXeJtGjjRp2FrRujHaoywAv", "locktime": 10, "amount": 0.2, "redeemScript": "63a8202bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b8876a91485b6808f97ff87b256ad97303408efc782ddd4466703c1c501b17576a9143207950793180d8659ab15861b935217848ddc596888ac"}, "sell": {"redeemblocknum": 1155898, "fulfiller": "mpFD3Knp5znDKAHyiYdXMGEYvxmShjdwSS", "fund_tx": "867468520a2dc4297031966978964827958b921f0e9521f6d080a87362a5c173", "currency": "bitcoin", "p2sh": "2N5htfxW99WhoHu5kyGHbn5f1KryjPEjkq8", "initiator": "mmvpYgRLu6FmoQpLkea3Rcpwx74CXTqurU", "amount": 0.1, "redeemScript": "63a8202bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b8876a9145fbec93a4f3473966d4f93a6a50d7cb6febe8bbf67033aa311b17576a9144654452de033bf41e0adc837585bc94f7bec292c6888ac"}}
{"buy": {"amount": 0.02, "redeem_tx": "cac2f4fadf431ebb63d72dfea9a8b17792f6fca0d72f325b55d4798a880abc2d", "redeemScript": "63a820c34f63ae5db1f9d5eff9f174617fd21cfdd8450d22432eac0db334c80c3553708876a91456ffb9b1b332411bb4401093351c3cd7e28ebfc76703f7c501b17576a914fada8c2f0edaa8352c1b9df192cd92473fcf0af26888ac", "currency": "zcash", "fulfiller": "tmYak55ijTBrx83oBnp9RHmqPZSp1uTnA61", "fund_tx": "08d763de2b2d7ff6e8153980a5334bfb87ee8cfb406df0c674b4f6934fd89ecd:1", "initiator": "tmHeMnn93YuuBRHFDCLrenuufM3Crgw2Udu", "p2sh": "t2Lm6sh7VQWrW1gDTAJ4PgnfWmehitEMdKt", "redeemblocknum": 116215, "locktime": 10}, "commitment": "c34f63ae5db1f9d5eff9f174617fd21cfdd8450d22432eac0db334c80c355370", "sell": {"amount": 0.01, "redeemScript": "63a820c34f63ae5db1f9d5eff9f174617fd21cfdd8450d22432eac0db334c80c3553708876a9148da278b7ce5f31d2e723ae64e73248cd9addbce3670351a311b17576a91404fac4b9ff3758aeccf3f0e54831934e23b5e0876888ac", "currency": "bitcoin", "fulfiller": "mtRrCpixF7EvScmoeym3iY9dQeaMFyNGS2", "fund_tx": "f88ef71f871ab5f8a0477305bff5180fcfcccf14cde5df19e7592c9620e8a3d9", "initiator": "mfyHQX6EypNbZVYfZ6qekgeyzjkT9JZ4et", "p2sh": "2MtpFpJ8D4sNVAit4TgZbDfuTr9jnwVeSHJ", "redeemblocknum": 1155921}}