]> git.codecow.com Git - libnemo.git/commitdiff
Fix frontier regex and allow special '0' opening block value.
authorChris Duncan <chris@codecow.com>
Sat, 8 Aug 2026 21:49:18 +0000 (14:49 -0700)
committerChris Duncan <chris@codecow.com>
Sat, 8 Aug 2026 21:49:18 +0000 (14:49 -0700)
src/lib/block/index.ts

index bb8a8931e4560177285cc89a6a0de9ca0cba5e81..23fb95c0e73e416b48f29b1b4ad0d590bc96b78a 100644 (file)
@@ -80,7 +80,7 @@ export class Block {
                        if (typeof previous !== 'string') {
                                throw new TypeError('Account frontier is unknown')
                        }
-                       if (!(/^([0-9A-F]{2}){1,64}$/i.test(previous))) {
+                       if (!hex.is(previous, 64) && previous !== '0') {
                                throw new RangeError('Invalid frontier hash')
                        }
                        this.account = account