diff --git a/sdk/program/src/pubkey.rs b/sdk/program/src/pubkey.rs index f31579fd4f..a8992c3672 100644 --- a/sdk/program/src/pubkey.rs +++ b/sdk/program/src/pubkey.rs @@ -176,7 +176,9 @@ impl Pubkey { let mut b = [0u8; 32]; let i = I.fetch_add(1); - b[0..8].copy_from_slice(&i.to_le_bytes()); + // use big endian representation to ensure that recent unique pubkeys + // are always greater than less recent unique pubkeys + b[0..8].copy_from_slice(&i.to_be_bytes()); Self::new(&b) }