Don't describe state for xmr style swaps.
This commit is contained in:
		
							parent
							
								
									c3cff91fca
								
							
						
					
					
						commit
						5e5bf31156
					
				@ -37,12 +37,17 @@
 | 
				
			|||||||
{% endif %}
 | 
					{% endif %}
 | 
				
			||||||
</table>
 | 
					</table>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<form method="post">
 | 
					<form method="post">
 | 
				
			||||||
{% if data.show_bid_form %}
 | 
					{% if data.show_bid_form %}
 | 
				
			||||||
<br/><h4>New Bid</h4>
 | 
					<br/><h4>New Bid</h4>
 | 
				
			||||||
<p>You will send {{ data.amt_to }} {{ data.tla_to }} and receive {{ data.amt_from }} {{ data.tla_from }} (excluding {{ data.amt_from_lock_spend_tx_fee }} {{ data.tla_from }} in tx fees). </p>
 | 
					<p>You will send {{ data.amt_to }} {{ data.tla_to }} and receive {{ data.amt_from }} {{ data.tla_from }}
 | 
				
			||||||
 | 
					{% if data.xmr_type == true %}
 | 
				
			||||||
 | 
					 (excluding {{ data.amt_from_lock_spend_tx_fee }} {{ data.tla_from }} in tx fees).
 | 
				
			||||||
 | 
					{% else %}
 | 
				
			||||||
 | 
					 (excluding a tx fee).
 | 
				
			||||||
 | 
					{% endif %}
 | 
				
			||||||
 | 
					</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<table>
 | 
					<table>
 | 
				
			||||||
<tr><td>Send From Address</td><td>
 | 
					<tr><td>Send From Address</td><td>
 | 
				
			||||||
<select name="addr_from">
 | 
					<select name="addr_from">
 | 
				
			||||||
 | 
				
			|||||||
@ -92,33 +92,36 @@ def describeBid(swap_client, bid, xmr_swap, offer, xmr_offer, bid_events, edit_b
 | 
				
			|||||||
    ticker_from = ci_from.ticker()
 | 
					    ticker_from = ci_from.ticker()
 | 
				
			||||||
    ticker_to = ci_to.ticker()
 | 
					    ticker_to = ci_to.ticker()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if bid.state == BidStates.BID_SENT:
 | 
					    state_description = ''
 | 
				
			||||||
        state_description = 'Waiting for seller to accept.'
 | 
					    if offer.swap_type == SwapTypes.SELLER_FIRST:
 | 
				
			||||||
    elif bid.state == BidStates.BID_RECEIVED:
 | 
					        if bid.state == BidStates.BID_SENT:
 | 
				
			||||||
        state_description = 'Waiting for seller to accept.'
 | 
					            state_description = 'Waiting for seller to accept.'
 | 
				
			||||||
    elif bid.state == BidStates.BID_ACCEPTED:
 | 
					        elif bid.state == BidStates.BID_RECEIVED:
 | 
				
			||||||
        if not bid.initiate_tx:
 | 
					            state_description = 'Waiting for seller to accept.'
 | 
				
			||||||
            state_description = 'Waiting for seller to send initiate tx.'
 | 
					        elif bid.state == BidStates.BID_ACCEPTED:
 | 
				
			||||||
        else:
 | 
					            if not bid.initiate_tx:
 | 
				
			||||||
            state_description = 'Waiting for initiate tx to confirm.'
 | 
					                state_description = 'Waiting for seller to send initiate tx.'
 | 
				
			||||||
    elif bid.state == BidStates.SWAP_INITIATED:
 | 
					            else:
 | 
				
			||||||
        state_description = 'Waiting for participate txn to be confirmed in {} chain'.format(ticker_to)
 | 
					                state_description = 'Waiting for initiate tx to confirm.'
 | 
				
			||||||
    elif bid.state == BidStates.SWAP_PARTICIPATING:
 | 
					        elif bid.state == BidStates.SWAP_INITIATED:
 | 
				
			||||||
        state_description = 'Waiting for initiate txn to be spent in {} chain'.format(ticker_from)
 | 
					            state_description = 'Waiting for participate txn to be confirmed in {} chain'.format(ticker_to)
 | 
				
			||||||
    elif bid.state == BidStates.SWAP_COMPLETED:
 | 
					        elif bid.state == BidStates.SWAP_PARTICIPATING:
 | 
				
			||||||
        state_description = 'Swap completed'
 | 
					            if bid.was_sent:
 | 
				
			||||||
        if bid.getITxState() == TxStates.TX_REDEEMED and bid.getPTxState() == TxStates.TX_REDEEMED:
 | 
					                state_description = 'Waiting for participate txn to be spent in {} chain'.format(ticker_to)
 | 
				
			||||||
            state_description += ' successfully'
 | 
					            else:
 | 
				
			||||||
        else:
 | 
					                state_description = 'Waiting for initiate txn to be spent in {} chain'.format(ticker_from)
 | 
				
			||||||
            state_description += ', ITX ' + strTxState(bid.getITxState()) + ', PTX ' + strTxState(bid.getPTxState())
 | 
					        elif bid.state == BidStates.SWAP_COMPLETED:
 | 
				
			||||||
    elif bid.state == BidStates.SWAP_TIMEDOUT:
 | 
					            state_description = 'Swap completed'
 | 
				
			||||||
        state_description = 'Timed out waiting for initiate txn'
 | 
					            if bid.getITxState() == TxStates.TX_REDEEMED and bid.getPTxState() == TxStates.TX_REDEEMED:
 | 
				
			||||||
    elif bid.state == BidStates.BID_ABANDONED:
 | 
					                state_description += ' successfully'
 | 
				
			||||||
        state_description = 'Bid abandoned'
 | 
					            else:
 | 
				
			||||||
    elif bid.state == BidStates.BID_ERROR:
 | 
					                state_description += ', ITX ' + strTxState(bid.getITxState()) + ', PTX ' + strTxState(bid.getPTxState())
 | 
				
			||||||
        state_description = bid.state_note
 | 
					        elif bid.state == BidStates.SWAP_TIMEDOUT:
 | 
				
			||||||
    else:
 | 
					            state_description = 'Timed out waiting for initiate txn'
 | 
				
			||||||
        state_description = ''
 | 
					        elif bid.state == BidStates.BID_ABANDONED:
 | 
				
			||||||
 | 
					            state_description = 'Bid abandoned'
 | 
				
			||||||
 | 
					        elif bid.state == BidStates.BID_ERROR:
 | 
				
			||||||
 | 
					            state_description = bid.state_note
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    data = {
 | 
					    data = {
 | 
				
			||||||
        'amt_from': ci_from.format_amount(bid.amount),
 | 
					        'amt_from': ci_from.format_amount(bid.amount),
 | 
				
			||||||
 | 
				
			|||||||
@ -68,6 +68,8 @@ UI_PORT = 12700 + PORT_OFS
 | 
				
			|||||||
BASE_PART_RPC_PORT = 19792
 | 
					BASE_PART_RPC_PORT = 19792
 | 
				
			||||||
BASE_BTC_RPC_PORT = 19796
 | 
					BASE_BTC_RPC_PORT = 19796
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NUM_NODES = 3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
logger = logging.getLogger()
 | 
					logger = logging.getLogger()
 | 
				
			||||||
logger.level = logging.DEBUG
 | 
					logger.level = logging.DEBUG
 | 
				
			||||||
if not len(logger.handlers):
 | 
					if not len(logger.handlers):
 | 
				
			||||||
@ -109,7 +111,7 @@ class Test(unittest.TestCase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        random.seed(time.time())
 | 
					        random.seed(time.time())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for i in range(3):
 | 
					        for i in range(NUM_NODES):
 | 
				
			||||||
            client_path = os.path.join(test_path, 'client{}'.format(i))
 | 
					            client_path = os.path.join(test_path, 'client{}'.format(i))
 | 
				
			||||||
            config_path = os.path.join(client_path, cfg.CONFIG_FILENAME)
 | 
					            config_path = os.path.join(client_path, cfg.CONFIG_FILENAME)
 | 
				
			||||||
            if RESET_TEST:
 | 
					            if RESET_TEST:
 | 
				
			||||||
@ -152,7 +154,7 @@ class Test(unittest.TestCase):
 | 
				
			|||||||
                    fp.write('minstakeinterval=5\n')
 | 
					                    fp.write('minstakeinterval=5\n')
 | 
				
			||||||
                    salt = generate_salt(16)
 | 
					                    salt = generate_salt(16)
 | 
				
			||||||
                    fp.write('rpcauth={}:{}${}\n'.format('test_part_' + str(i), salt, password_to_hmac(salt, 'test_part_pwd_' + str(i))))
 | 
					                    fp.write('rpcauth={}:{}${}\n'.format('test_part_' + str(i), salt, password_to_hmac(salt, 'test_part_pwd_' + str(i))))
 | 
				
			||||||
                    for ip in range(3):
 | 
					                    for ip in range(NUM_NODES):
 | 
				
			||||||
                        if ip != i:
 | 
					                        if ip != i:
 | 
				
			||||||
                            fp.write('connect=127.0.0.1:{}\n'.format(PARTICL_PORT_BASE + ip + PORT_OFS))
 | 
					                            fp.write('connect=127.0.0.1:{}\n'.format(PARTICL_PORT_BASE + ip + PORT_OFS))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -171,14 +173,14 @@ class Test(unittest.TestCase):
 | 
				
			|||||||
                    fp.write('upnp=0\n')
 | 
					                    fp.write('upnp=0\n')
 | 
				
			||||||
                    salt = generate_salt(16)
 | 
					                    salt = generate_salt(16)
 | 
				
			||||||
                    fp.write('rpcauth={}:{}${}\n'.format('test_btc_' + str(i), salt, password_to_hmac(salt, 'test_btc_pwd_' + str(i))))
 | 
					                    fp.write('rpcauth={}:{}${}\n'.format('test_btc_' + str(i), salt, password_to_hmac(salt, 'test_btc_pwd_' + str(i))))
 | 
				
			||||||
                    for ip in range(3):
 | 
					                    for ip in range(NUM_NODES):
 | 
				
			||||||
                        if ip != i:
 | 
					                        if ip != i:
 | 
				
			||||||
                            fp.write('connect=127.0.0.1:{}\n'.format(BITCOIN_PORT_BASE + ip + PORT_OFS))
 | 
					                            fp.write('connect=127.0.0.1:{}\n'.format(BITCOIN_PORT_BASE + ip + PORT_OFS))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                with open(os.path.join(client_path, 'monero', 'monerod.conf'), 'a') as fp:
 | 
					                with open(os.path.join(client_path, 'monero', 'monerod.conf'), 'a') as fp:
 | 
				
			||||||
                    fp.write('p2p-bind-ip=127.0.0.1\n')
 | 
					                    fp.write('p2p-bind-ip=127.0.0.1\n')
 | 
				
			||||||
                    fp.write('p2p-bind-port={}\n'.format(XMR_BASE_P2P_PORT + i + PORT_OFS))
 | 
					                    fp.write('p2p-bind-port={}\n'.format(XMR_BASE_P2P_PORT + i + PORT_OFS))
 | 
				
			||||||
                    for ip in range(3):
 | 
					                    for ip in range(NUM_NODES):
 | 
				
			||||||
                        if ip != i:
 | 
					                        if ip != i:
 | 
				
			||||||
                            fp.write('add-exclusive-node=127.0.0.1:{}\n'.format(XMR_BASE_P2P_PORT + ip + PORT_OFS))
 | 
					                            fp.write('add-exclusive-node=127.0.0.1:{}\n'.format(XMR_BASE_P2P_PORT + ip + PORT_OFS))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -220,7 +222,7 @@ class Test(unittest.TestCase):
 | 
				
			|||||||
    def start_processes(self):
 | 
					    def start_processes(self):
 | 
				
			||||||
        self.delay_event.clear()
 | 
					        self.delay_event.clear()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for i in range(3):
 | 
					        for i in range(NUM_NODES):
 | 
				
			||||||
            self.processes.append(multiprocessing.Process(target=self.run_thread, args=(i,)))
 | 
					            self.processes.append(multiprocessing.Process(target=self.run_thread, args=(i,)))
 | 
				
			||||||
            self.processes[-1].start()
 | 
					            self.processes[-1].start()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -243,6 +245,9 @@ class Test(unittest.TestCase):
 | 
				
			|||||||
            callbtcrpc(0, 'generatetoaddress', [num_blocks, self.btc_addr])
 | 
					            callbtcrpc(0, 'generatetoaddress', [num_blocks, self.btc_addr])
 | 
				
			||||||
        logging.info('BTC blocks: %d', callbtcrpc(0, 'getblockchaininfo')['blocks'])
 | 
					        logging.info('BTC blocks: %d', callbtcrpc(0, 'getblockchaininfo')['blocks'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Lower output split threshold for more stakeable outputs
 | 
				
			||||||
 | 
					        for i in range(NUM_NODES):
 | 
				
			||||||
 | 
					            callpartrpc(i, 'walletsettings', ['stakingoptions', {'stakecombinethreshold': 100, 'stakesplitthreshold': 200}])
 | 
				
			||||||
        self.update_thread = threading.Thread(target=updateThread, args=(self,))
 | 
					        self.update_thread = threading.Thread(target=updateThread, args=(self,))
 | 
				
			||||||
        self.update_thread.start()
 | 
					        self.update_thread.start()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user