mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 13:47:19 +00:00
nft-nd-nns: clean up old entries on re-registration, fix #2570
This commit is contained in:
parent
71b721c72a
commit
3bc53b3aa1
2 changed files with 7 additions and 0 deletions
|
@ -265,6 +265,10 @@ func Register(name string, owner interop.Hash160) bool {
|
|||
}
|
||||
oldOwner = ns.Owner
|
||||
updateBalance(ctx, []byte(name), oldOwner, -1)
|
||||
it := storage.Find(ctx, append([]byte{prefixRecord}, tokenKey...), storage.KeysOnly)
|
||||
for iterator.Next(it) {
|
||||
storage.Delete(ctx, iterator.Value(it))
|
||||
}
|
||||
} else {
|
||||
updateTotalSupply(ctx, +1)
|
||||
}
|
||||
|
|
|
@ -132,6 +132,9 @@ func TestExpiration(t *testing.T) {
|
|||
b5.Timestamp = b4.Timestamp + 1000
|
||||
require.NoError(t, bc.AddBlock(e.SignBlock(b5)))
|
||||
e.CheckFault(t, tx.Hash(), "name has expired")
|
||||
|
||||
cAcc.Invoke(t, true, "register", "first.com", acc.ScriptHash()) // Re-register.
|
||||
cAcc.Invoke(t, stackitem.Null{}, "resolve", "first.com", int64(nns.TXT))
|
||||
}
|
||||
|
||||
const millisecondsInYear = 365 * 24 * 3600 * 1000
|
||||
|
|
Loading…
Reference in a new issue