Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 build.zig.zon
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
9 changes: 8 additions & 1 deletion src/public_key.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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));
}
Loading