Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Neo/UInt160.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public static bool TryParse(string str, out UInt160 result)
var data = new byte[Length];
for (var i = 0; i < Length; i++)
{
if (!byte.TryParse(str.AsSpan(i * 2 + startIndex, 2), NumberStyles.HexNumber, null, out data[Length - i - 1]))
if (!byte.TryParse(str.AsSpan(i * 2 + startIndex, 2), NumberStyles.AllowHexSpecifier, null, out data[Length - i - 1]))
return false;
}
result = new(data);
Expand Down
2 changes: 2 additions & 0 deletions tests/Neo.UnitTests/UT_UInt160.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public void TestTryParse()
Assert.AreEqual("0x1230000000000000000000000000000000000000", temp.ToString());
Assert.AreEqual(false, UInt160.TryParse("000000000000000000000000000000000000000", out _));
Assert.AreEqual(false, UInt160.TryParse("0xKK00000000000000000000000000000000000000", out _));

Assert.AreEqual(false, UInt160.TryParse(" 1 2 3 45 000000000000000000000000000000", out _));
}

[TestMethod]
Expand Down
Loading