Skip to content

Commit 1ff8706

Browse files
TinyChain --> validateSig block address 0
1 parent 47e5600 commit 1ff8706

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/TinyChain/Block.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,17 @@ class TinyChainBlock {
350350
* and ensures that the signature is valid. If any signature is invalid,
351351
* it throws an error identifying the problematic transaction and its index.
352352
*
353-
* @throws {Error} If any transaction has an invalid ECDSA signature or if the
354-
* number of validated transactions does not match the expected count.
353+
* @throws {Error} If any transaction has an invalid ECDSA signature,
354+
* or if any transaction has an address equal to "0".
355355
*/
356356
validateSig() {
357357
const dc = this.getData();
358358
const sigs = this.getSigs();
359359
for (const index in dc) {
360360
const data = dc[index];
361361
const sig = sigs[index];
362+
if (data.address === '0')
363+
throw new Error(`Transaction at index "${index}" has an invalid address "0".`);
362364
if (
363365
!this.#signer.verifyECDSA(
364366
this.#parser.serializeDeep(data),

0 commit comments

Comments
 (0)