Skip to content

Commit

Permalink
Fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
ShengguangXiao committed Sep 29, 2020
1 parent e01dd52 commit a3764c7
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions test/functional/feature_tokens_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,32 @@ def run_test(self):
errorString = e.error['message']
assert("collateral-locked," in errorString)

# Create new GOLD token
newGoldTx = self.nodes[0].createtoken({
"symbol": "GOLD",
"name": "shiny gold",
"collateralAddress": collateral0
}, [])
self.nodes[0].generate(1)

# Get token by SYMBOL#ID
t129 = self.nodes[0].gettoken("GOLD#129")
assert_equal(t129['129']['symbol'], "GOLD")
assert_equal(self.nodes[0].gettoken("GOLD#129"), t129)

# RESIGNING:
#========================
# Try to resign w/o auth (no money on auth/collateral address)
try:
self.nodes[0].destroytoken("GOLD#128", [])
except JSONRPCException as e:
errorString = e.error['message']
assert("Can't find any UTXO's" in errorString)

# Funding auth address for resigning
fundingTx = self.nodes[0].sendtoaddress(collateral0, 1)
self.nodes[0].generate(1)

# Spend unlocked collateral
# This checks two cases at once:
# 1) Finally, we should not fail on accept to mempool
Expand All @@ -132,20 +158,10 @@ def run_test(self):
# Don't mine here, check mempool after reorg!
# self.nodes[0].generate(1)


# REVERTING:
#========================
print ("Reverting...")
# Revert token destruction!
self.start_node(1)
self.nodes[1].generate(5)
# Check that collateral spending tx is still in the mempool
assert_equal(sendedTxHash, self.nodes[0].getrawmempool()[0])

connect_nodes_bi(self.nodes, 0, 1)
self.sync_blocks(self.nodes[0:2])

assert_equal(sorted(self.nodes[0].getrawmempool()), sorted([fundingTx, destroyTx, newGoldTx]))
assert_equal(sorted(self.nodes[0].getrawmempool()), sorted([fundingTx, newGoldTx]))
assert_equal(self.nodes[0].listtokens()['128']['destructionHeight'], -1)
assert_equal(self.nodes[0].listtokens()['128']['destructionTx'], '0000000000000000000000000000000000000000000000000000000000000000')

Expand All @@ -156,7 +172,7 @@ def run_test(self):
connect_nodes_bi(self.nodes, 0, 2)
self.sync_blocks(self.nodes[0:3])
assert_equal(len(self.nodes[0].listtokens()), 1)
assert_equal(sorted(self.nodes[0].getrawmempool()), sorted([createTokenTx, fundingTx, destroyTx, newGoldTx]))
assert_equal(sorted(self.nodes[0].getrawmempool()), sorted([createTokenTx, fundingTx, newGoldTx]))

if __name__ == '__main__':
TokensBasicTest ().main ()

0 comments on commit a3764c7

Please sign in to comment.