]> git.codecow.com Git - libnemo.git/commitdiff
Validate block hash processing response.
authorChris Duncan <chris@codecow.com>
Mon, 3 Aug 2026 06:44:23 +0000 (23:44 -0700)
committerChris Duncan <chris@codecow.com>
Mon, 3 Aug 2026 06:44:23 +0000 (23:44 -0700)
src/lib/block/index.ts

index ed5e453b7d3dc8f227717f2a51d80a822788b241..07c6c4a17860b7d6027c4d34982d9c696f0a989a 100644 (file)
@@ -210,7 +210,7 @@ export class Block {
                        block: this.toJSON()
                }
                const res = await rpc.post('process', data)
-               if (res.hash == null) {
+               if (res == null || typeof res !== 'object' || !('hash' in res) || typeof res.hash !== 'string') {
                        throw new Error('Block could not be processed', { cause: res })
                }
                return res.hash