Skip to content

Commit eceea02

Browse files
authored
Merge pull request #2 from tuyennhv/tuyennhv/rewards-api
fix: clone states to compute block rewards
2 parents 719ab1d + 51bbf5e commit eceea02

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/beacon-node/src/chain/chain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,6 @@ export class BeaconChain implements IBeaconChain {
10011001
throw Error(`Pre-state is unavailable given block's parent root ${toHexString(block.parentRoot)}`);
10021002
}
10031003

1004-
return computeBlockRewards(block, preState, postState);
1004+
return computeBlockRewards(block, preState.clone(), postState?.clone());
10051005
}
10061006
}

packages/beacon-node/src/chain/rewards/blockRewards.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ function computeSyncAggregateReward(block: altair.BeaconBlock, preState: CachedB
9494
return 0; // phase0 block does not have syncAggregate
9595
}
9696
}
97+
9798
/**
9899
* Calculate rewards received by block proposer for including proposer slashings.
99100
* All proposer slashing rewards go to block proposer and none to whistleblower as of Deneb

0 commit comments

Comments
 (0)