Fix strange int compare bug.

This commit is contained in:
tecnovert 2019-07-20 21:42:04 +02:00
parent 7c57dff1a9
commit f1efb0a317
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
2 changed files with 10 additions and 2 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ __pycache__
/dist/
/*.egg-info
/*.egg
/*.eggs

View file

@ -601,6 +601,13 @@ class BasicSwap():
for bid in session.query(Bid):
if bid.state and bid.state > BidStates.BID_RECEIVED and bid.state < BidStates.SWAP_COMPLETED:
self.log.debug('Loading active bid %s', bid.bid_id.hex())
offer = session.query(Offer).filter_by(offer_id=bid.offer_id).first()
assert(offer), 'Offer not found'
self.swaps_in_progress[bid.bid_id] = (bid, offer)
# TODO: load txns, must store height 1st seen
finally:
session.close()
session.remove()
@ -1476,7 +1483,7 @@ class BasicSwap():
continue
# Verify amount
if assert_amount:
assert(o['amount'] * COIN == assert_amount), 'Incorrect output amount in txn {}.'.format(assert_txid)
assert(int(o['amount'] * COIN) == int(assert_amount)), 'Incorrect output amount in txn {}.'.format(assert_txid)
if not sum_output:
if o['height'] > 0:
@ -1519,7 +1526,7 @@ class BasicSwap():
initiate_txn = self.callcoinrpc(coin_from, 'getrawtransaction', [initiate_txnid_hex, True])
# Verify amount
vout = getVoutByAddress(initiate_txn, p2sh)
assert(initiate_txn['vout'][vout]['value'] * COIN == bid.amount), 'Incorrect output amount in initiate txn.'
assert(int(initiate_txn['vout'][vout]['value'] * COIN) == int(bid.amount)), 'Incorrect output amount in initiate txn.'
bid.initiate_txn_conf = initiate_txn['confirmations']
try: