From 8feb41290154e5ecd0a9a1028fda88b7f93c0794 Mon Sep 17 00:00:00 2001 From: Sivachandran Paramasivam Date: Wed, 17 Jun 2026 16:59:47 +0530 Subject: [PATCH] Fix: Create BigNumber with NaN value in Dish.valid The constructor expects the default value but we are not passing it. So it was throwing undefined error. Now passing NaN as default value. --- src/core/Dish.mjs | 2 +- tests/node/tests/Dish.mjs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/Dish.mjs b/src/core/Dish.mjs index 11b1ff9f..acdf02d9 100755 --- a/src/core/Dish.mjs +++ b/src/core/Dish.mjs @@ -292,7 +292,7 @@ class Dish { and reinitialise it as a BigNumber object. */ if (Object.keys(this.value).sort().equals(["c", "e", "s"])) { - const temp = new BigNumber(); + const temp = new BigNumber(NaN); temp.c = this.value.c; temp.e = this.value.e; temp.s = this.value.s; diff --git a/tests/node/tests/Dish.mjs b/tests/node/tests/Dish.mjs index 58da00bf..f648ab66 100644 --- a/tests/node/tests/Dish.mjs +++ b/tests/node/tests/Dish.mjs @@ -8,5 +8,8 @@ TestRegister.addApiTests([ const dish = new Dish(); assert(dish.presentAs); }), - + it("Disk - valid: should not err on serialized big_number", () => { + const dish = new Dish({ c: 0, e: 0, s: 0 }, Dish.BIG_NUMBER); + assert(dish.valid()); + }) ]);