From 0b299fcbe0f9c690c674eba95fbd37e6c3cb5722 Mon Sep 17 00:00:00 2001 From: acolytec3 <17355484+acolytec3@users.noreply.github.com> Date: Wed, 3 May 2023 08:42:39 -0400 Subject: [PATCH] Fix empty withdrawals logic pt 2 --- packages/blockchain/src/db/manager.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/blockchain/src/db/manager.ts b/packages/blockchain/src/db/manager.ts index 1ff20b2e33..9da7d93cc6 100644 --- a/packages/blockchain/src/db/manager.ts +++ b/packages/blockchain/src/db/manager.ts @@ -115,8 +115,11 @@ export class DBManager { // If this block had empty withdrawals push an empty array in body if (header.withdrawalsRoot !== undefined) { // Do extra validations for withdrawal before assuming empty withdrawals - if (!equalsBytes(header.withdrawalsRoot, KECCAK256_RLP)) { - throw new Error('withdrawals root shoot be equal to hash of null') + if ( + !equalsBytes(header.withdrawalsRoot, KECCAK256_RLP) && + (body.length !== 3 || body[2]?.length === 0) + ) { + throw new Error('withdrawals root shoot be equal to hash of null when no withdrawals') } if (body.length !== 3) body.push([]) }