Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
localhuman committed Apr 11, 2018
2 parents 2d511ee + 815e8e6 commit 0c4b6df
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project are documented in this file.
-----------------------
- add ``ServiceEnabled`` boolean to settings to determine whether nodes should send other nodes blocks
- updated new block retrieval mechanism
- fix for token_delete command not removing tokens from wallet file
- fixed sc-events and notification DB showing previous block height instead of final block height of event
- persist refund() notify events in notification DB

Expand Down
9 changes: 5 additions & 4 deletions neo/Implementations/Wallets/peewee/UserWallet.py
Expand Up @@ -480,16 +480,17 @@ def PubKeys(self):

return jsn

def DeleteNEP5Token(self, token):
def DeleteNEP5Token(self, script_hash):

success = super(UserWallet, self).DeleteNEP5Token(token)
token = super(UserWallet, self).DeleteNEP5Token(script_hash)

try:
db_token = NEP5Token.get(ContractHash=token.ScriptHash.ToBytes())
db_token.delete_instance()
except Exception as e:
pass
return success
return False

return True

def DeleteAddress(self, script_hash):
success, coins_toremove = super(UserWallet, self).DeleteAddress(script_hash)
Expand Down
8 changes: 8 additions & 0 deletions neo/Implementations/Wallets/peewee/test_user_wallet.py
Expand Up @@ -150,8 +150,16 @@ def test_7_import_token(self):

wallet.AddNEP5Token(token)

wallet = self.GetWallet1(recreate=True) # re-open wallet

self.assertEqual(len(wallet.GetTokens()), 1)

wallet.DeleteNEP5Token(token.ScriptHash)

wallet = self.GetWallet1(recreate=True) # re-open wallet

self.assertEqual(len(wallet.GetTokens()), 0)

def test_8_named_addr(self):

wallet = self.GetWallet1()
Expand Down
2 changes: 1 addition & 1 deletion neo/Wallets/Wallet.py
Expand Up @@ -199,7 +199,7 @@ def DeleteNEP5Token(self, script_hash):
token (UInt160): Token Contract script hash
Returns:
bool: success status.
NEP5Token: the token object removed from the wallet
"""
return self._tokens.pop(script_hash.ToBytes())

Expand Down

0 comments on commit 0c4b6df

Please sign in to comment.