Skip to content

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
terencechain committed Feb 8, 2025
1 parent 7e2a5a0 commit 74adbe6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 0 additions & 1 deletion beacon-chain/state/state-native/setters_consolidation.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func (b *BeaconState) AppendPendingConsolidation(val *ethpb.PendingConsolidation

b.pendingConsolidations = append(pendingConsolidations, val)
b.markFieldAsDirty(types.PendingConsolidations)
b.addDirtyIndices(types.PendingConsolidations, []uint64{uint64(len(b.pendingConsolidations) - 1)})

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/state/state-native/setters_deposits.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (b *BeaconState) AppendPendingDeposit(pd *ethpb.PendingDeposit) error {

b.pendingDeposits = append(pendingDeposits, pd)
b.markFieldAsDirty(types.PendingDeposits)
b.addDirtyIndices(types.PendingDeposits, []uint64{uint64(len(b.pendingDeposits) - 1)})

return nil
}

Expand Down
11 changes: 8 additions & 3 deletions beacon-chain/state/state-native/setters_withdrawal.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (b *BeaconState) AppendPendingPartialWithdrawal(ppw *eth.PendingPartialWith

b.pendingPartialWithdrawals = append(pendingPartialWithdrawals, ppw)
b.markFieldAsDirty(types.PendingPartialWithdrawals)
b.addDirtyIndices(types.PendingPartialWithdrawals, []uint64{uint64(len(b.pendingPartialWithdrawals) - 1)})

return nil
}

Expand All @@ -85,8 +85,13 @@ func (b *BeaconState) DequeuePendingPartialWithdrawals(n uint64) error {
b.lock.Lock()
defer b.lock.Unlock()

b.sharedFieldReferences[types.PendingPartialWithdrawals].MinusRef()
b.sharedFieldReferences[types.PendingPartialWithdrawals] = stateutil.NewRef(1)
if b.sharedFieldReferences[types.PendingPartialWithdrawals].Refs() > 1 {
pendingPartialWithdrawals := make([]*eth.PendingPartialWithdrawal, len(b.pendingPartialWithdrawals))
copy(pendingPartialWithdrawals, b.pendingPartialWithdrawals)
b.pendingPartialWithdrawals = pendingPartialWithdrawals
b.sharedFieldReferences[types.PendingPartialWithdrawals].MinusRef()
b.sharedFieldReferences[types.PendingPartialWithdrawals] = stateutil.NewRef(1)
}

b.pendingPartialWithdrawals = b.pendingPartialWithdrawals[n:]

Expand Down

0 comments on commit 74adbe6

Please sign in to comment.