diff --git a/build.zig.zon b/build.zig.zon index c898699..5d303ad 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,7 +1,7 @@ .{ .fingerprint = 0xdc47aff950fd68c0, .name = .solana_program_sdk, - .version = "0.16.1", + .version = "0.16.2", .minimum_zig_version = "0.14.0", // This field is optional. diff --git a/src/public_key.zig b/src/public_key.zig index 778b5c8..76c7677 100644 --- a/src/public_key.zig +++ b/src/public_key.zig @@ -47,7 +47,7 @@ pub const PublicKey = extern struct { } pub fn equals(self: PublicKey, other: PublicKey) bool { - return self.bytes == other.bytes; + return std.mem.eql(u8, &self.bytes, &other.bytes); } pub fn isPointOnCurve(self: PublicKey) bool { @@ -238,3 +238,10 @@ test "public_key: comptime find program address" { try testing.expectFmt("2PjSSVURwJV4o9wz1BDVwwddvcUCuF1NKFpcQBF9emYJ", "{}", .{pda.address}); try comptime testing.expectEqual(@as(u8, 255), pda.bump_seed[0]); } + +test "public_key: equality" { + const id = comptime PublicKey.comptimeFromBase58("11111111111111111111111111111111"); + const id2 = comptime PublicKey.comptimeFromBase58("11111111111111111111111111111111"); + try testing.expectEqual(id, id2); + try testing.expect(id.equals(id2)); +}