Skip to content

Commit

Permalink
eth/catalyst: update payload id computation (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
protolambda authored Sep 9, 2022
1 parent 4d4ea34 commit 4ef278d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions eth/catalyst/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,14 @@ func computePayloadId(headBlockHash common.Hash, params *beacon.PayloadAttribute
binary.Write(hasher, binary.BigEndian, params.Timestamp)
hasher.Write(params.Random[:])
hasher.Write(params.SuggestedFeeRecipient[:])
if params.NoTxPool || len(params.Transactions) > 0 { // extend if extra payload attributes are used
binary.Write(hasher, binary.BigEndian, params.NoTxPool)
binary.Write(hasher, binary.BigEndian, uint64(len(params.Transactions)))
for _, tx := range params.Transactions {
binary.Write(hasher, binary.BigEndian, uint64(len(tx)))
hasher.Write(tx)
}
}
var out beacon.PayloadID
copy(out[:], hasher.Sum(nil)[:8])
return out
Expand Down

0 comments on commit 4ef278d

Please sign in to comment.