From 6a2b5e60bf9ce970efb679b1670812e8ddaaad87 Mon Sep 17 00:00:00 2001 From: cathugger Date: Sun, 6 Aug 2023 05:13:37 +0300 Subject: [PATCH] fix checkpoint loading (use carry for add) --- main.c | 7 +++++-- worker.c | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index c5d2844..164307c 100644 --- a/main.c +++ b/main.c @@ -612,8 +612,11 @@ int main(int argc,char **argv) fclose(checkout); // Apply checkpoint to determseed - for (int i = 0; i < SEED_LEN; i++) - determseed[i] += checkpoint[i]; + bool carry = 0; + for (int i = 0; i < SEED_LEN; i++) { + determseed[i] += checkpoint[i] + carry; + carry = determseed[i] < checkpoint[i]; + } } } } diff --git a/worker.c b/worker.c index 78376ce..0a08d27 100644 --- a/worker.c +++ b/worker.c @@ -150,6 +150,7 @@ union pubonionunion { } i; } ; +/* // little endian inc static void addsk32(u8 *sk) { @@ -160,6 +161,7 @@ static void addsk32(u8 *sk) if (!c) break; } } +*/ // 0123 4567 xxxx --3--> 3456 7xxx // 0123 4567 xxxx --1--> 1234 567x