diff --git a/src/neo/SmartContract/Native/NameService.cs b/src/neo/SmartContract/Native/NameService.cs index 4e6bec1d36..d90a05c21b 100644 --- a/src/neo/SmartContract/Native/NameService.cs +++ b/src/neo/SmartContract/Native/NameService.cs @@ -5,6 +5,7 @@ using Neo.Persistence; using Neo.VM; using Neo.VM.Types; +using Neo.Wallets; using System; using System.Collections.Generic; using System.Linq; @@ -172,6 +173,11 @@ private void SetRecord(ApplicationEngine engine, string name, RecordType type, s if (!nameRegex.IsMatch(name)) throw new ArgumentException(null, nameof(name)); switch (type) { + case RecordType.NEO: + if (!UInt160.TryParse(data, out var scriptHash)) + scriptHash = data.ToScriptHash(); + data = scriptHash.ToString(); + break; case RecordType.A: if (!ipv4Regex.IsMatch(data)) throw new FormatException(); if (!IPAddress.TryParse(data, out IPAddress address)) throw new FormatException(); diff --git a/src/neo/SmartContract/Native/RecordType.cs b/src/neo/SmartContract/Native/RecordType.cs index 9ecf067c61..03c5ec489f 100644 --- a/src/neo/SmartContract/Native/RecordType.cs +++ b/src/neo/SmartContract/Native/RecordType.cs @@ -2,6 +2,10 @@ namespace Neo.SmartContract.Native { public enum RecordType : byte { + #region + NEO = 0, + #endregion + #region [RFC 1035](https://tools.ietf.org/html/rfc1035) A = 1, CNAME = 5,