Skip to content

Commit

Permalink
Merge pull request #2 from tuyennhv/tuyennhv/rewards-api
Browse files Browse the repository at this point in the history
fix: clone states to compute block rewards
  • Loading branch information
ensi321 committed Feb 20, 2024
2 parents 719ab1d + 51bbf5e commit eceea02
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/beacon-node/src/chain/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,6 @@ export class BeaconChain implements IBeaconChain {
throw Error(`Pre-state is unavailable given block's parent root ${toHexString(block.parentRoot)}`);
}

return computeBlockRewards(block, preState, postState);
return computeBlockRewards(block, preState.clone(), postState?.clone());
}
}
1 change: 1 addition & 0 deletions packages/beacon-node/src/chain/rewards/blockRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ function computeSyncAggregateReward(block: altair.BeaconBlock, preState: CachedB
return 0; // phase0 block does not have syncAggregate
}
}

/**
* Calculate rewards received by block proposer for including proposer slashings.
* All proposer slashing rewards go to block proposer and none to whistleblower as of Deneb
Expand Down

0 comments on commit eceea02

Please sign in to comment.