Skip to content

Commit

Permalink
Merge pull request #11 from neo-project/master
Browse files Browse the repository at this point in the history
fix BigInteger0 storage outputs null  (neo-project#1471)
  • Loading branch information
Qiao-Jin committed Mar 18, 2020
2 parents 9cbcfdc + 7df68fc commit 1962b94
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/neo/SmartContract/InteropService.Storage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,10 @@ private static bool PutExInternal(ApplicationEngine engine, StorageContext conte

if (engine.Snapshot.Storages.TryGet(skey)?.IsConstant == true) return false;

if (value.Length == 0 && !flags.HasFlag(StorageFlags.Constant))
{
// If put 'value' is empty (and non-const), we remove it (implicit `Storage.Delete`)
engine.Snapshot.Storages.Delete(skey);
}
else
{
StorageItem item = engine.Snapshot.Storages.GetAndChange(skey, () => new StorageItem());
item.Value = value;
item.IsConstant = flags.HasFlag(StorageFlags.Constant);
}
StorageItem item = engine.Snapshot.Storages.GetAndChange(skey, () => new StorageItem());
item.Value = value;
item.IsConstant = flags.HasFlag(StorageFlags.Constant);

return true;
}

Expand Down

0 comments on commit 1962b94

Please sign in to comment.