Don't timeout if initiate tx is known.

This commit is contained in:
tecnovert 2019-07-26 00:35:02 +02:00
parent 41ad7201e9
commit 267ff02d3f
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
3 changed files with 15 additions and 4 deletions

View file

@ -132,7 +132,7 @@ ABS_LOCK_TIME = 4
SEQUENCE_LOCKTIME_GRANULARITY = 9 # 512 seconds
SEQUENCE_LOCKTIME_TYPE_FLAG = (1 << 22)
SEQUENCE_LOCKTIME_MASK = 0x0000ffff
INITIATE_TX_TIMEOUT = 20 * 60
INITIATE_TX_TIMEOUT = 30 * 60
def getOfferState(state):
@ -1756,7 +1756,8 @@ class BasicSwap():
save_bid = True
# Bid times out if buyer doesn't see tx in chain within INITIATE_TX_TIMEOUT seconds
if bid.state_time + INITIATE_TX_TIMEOUT < int(time.time()):
if bid.initiate_txid is None and \
bid.state_time + INITIATE_TX_TIMEOUT < int(time.time()):
self.log.info('Swap timed out waiting for initiate tx for bid %s', bid_id.hex())
bid.setState(BidStates.SWAP_TIMEDOUT)
self.saveBid(bid_id, bid)

View file

@ -315,8 +315,12 @@ class HttpHandler(BaseHTTPRequestHandler):
raise ValueError('Bad bid ID')
swap_client = self.server.swap_client
content = html_content_start(self.server.title, self.server.title) \
+ '<h3>Advance: ' + bid_id.hex() + '</h3>'
template = env.get_template('advance.html')
return bytes(template.render(
title=self.server.title,
h2=self.server.title,
bid_id=bid_id.hex(),
), 'UTF-8')
def page_bid(self, url_split, post_string):
assert(len(url_split) > 2), 'Bid ID not specified'

6
templates/advance.html Normal file
View file

@ -0,0 +1,6 @@
{% include 'header.html' %}
<h3>Advance Bid {{ bid_id }}</h3>
<p><a href="/">home</a></p>
</body></html>