forked from townforge/townforge
more work on trade command
This commit is contained in:
parent
331bfa7a75
commit
ed0defe38e
@ -618,6 +618,31 @@ class CCTest():
|
||||
assert res.balance == expected_balances[i]
|
||||
assert res.block_balances == expected_block_balances[i]
|
||||
|
||||
# matching to a non existing tx
|
||||
ok = False
|
||||
try: self.wallet[0].cc_trade_blocks(True, 1, 1, 80, 1500, matches = [{'txid': "4"*64, 'amount': 1}], cost = 80)
|
||||
except: ok = True
|
||||
assert ok
|
||||
|
||||
# matching to an existing tx that's not a trade command
|
||||
res = daemon.getblockheaderbyheight(50)
|
||||
miner_tx_hash = res.block_header.miner_tx_hash
|
||||
ok = False
|
||||
try: self.wallet[0].cc_trade_blocks(True, 1, 1, 80, 1500, matches = [{'txid': miner_tx_hash, 'amount': 1}], cost = 80)
|
||||
except: ok = True
|
||||
assert ok
|
||||
|
||||
# matching with non matching price
|
||||
ok = False
|
||||
try: self.wallet[0].cc_trade_blocks(False, 1, 1, 81, 1500, matches = [{'txid': offer_1_5_80_txid, 'amount': 1}], cost = 80)
|
||||
except: ok = True
|
||||
assert ok
|
||||
|
||||
# matching too much
|
||||
ok = False
|
||||
try: self.wallet[0].cc_trade_blocks(False, 1, 10, 80, 1500, matches = [{'txid': offer_1_5_80_txid, 'amount': 1}], cost = 800)
|
||||
except: ok = True
|
||||
assert ok
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user