Skip to content

Commit

Permalink
Handle deposit tx rlp encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
pcw109550 committed Jun 23, 2023
1 parent f75da67 commit e487de4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,8 @@ func (bb Body) payloadSize() (payloadSize int, txsLen, unclesLen, withdrawalsLen
txLen = t.EncodingSize()
case *DynamicFeeTransaction:
txLen = t.EncodingSize()
case *DepositTx:
txLen = t.EncodingSize()
}
if txLen >= 56 {
txsLen += bitsToBytes(bits.Len(uint(txLen)))
Expand Down Expand Up @@ -1044,6 +1046,10 @@ func (bb Body) EncodeRLP(w io.Writer) error {
if err := t.EncodeRLP(w); err != nil {
return err
}
case *DepositTx:
if err := t.EncodeRLP(w); err != nil {
return err
}
}
}
// encode Uncles
Expand Down
18 changes: 18 additions & 0 deletions eth/protocols/eth/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ func (tp TransactionsPacket) EncodeRLP(w io.Writer) error {
txLen = t.EncodingSize()
case *types.DynamicFeeTransaction:
txLen = t.EncodingSize()
case *types.DepositTx:
txLen = t.EncodingSize()
}
if txLen >= 56 {
txsLen += (bits.Len(uint(txLen)) + 7) / 8
Expand Down Expand Up @@ -237,6 +239,10 @@ func (tp TransactionsPacket) EncodeRLP(w io.Writer) error {
if err := t.EncodeRLP(w); err != nil {
return err
}
case *types.DepositTx:
if err := t.EncodeRLP(w); err != nil {
return err
}
}
}
return nil
Expand Down Expand Up @@ -523,6 +529,8 @@ func (ptp PooledTransactionsPacket) EncodeRLP(w io.Writer) error {
txLen = t.EncodingSize()
case *types.DynamicFeeTransaction:
txLen = t.EncodingSize()
case *types.DepositTx:
txLen = t.EncodingSize()
}
if txLen >= 56 {
txsLen += (bits.Len(uint(txLen)) + 7) / 8
Expand Down Expand Up @@ -552,6 +560,10 @@ func (ptp PooledTransactionsPacket) EncodeRLP(w io.Writer) error {
if err := t.EncodeRLP(w); err != nil {
return err
}
case *types.DepositTx:
if err := t.EncodeRLP(w); err != nil {
return err
}
}
}
return nil
Expand Down Expand Up @@ -597,6 +609,8 @@ func (ptp66 PooledTransactionsPacket66) EncodeRLP(w io.Writer) error {
txLen = t.EncodingSize()
case *types.DynamicFeeTransaction:
txLen = t.EncodingSize()
case *types.DepositTx:
txLen = t.EncodingSize()
}
if txLen >= 56 {
txsLen += (bits.Len(uint(txLen)) + 7) / 8
Expand Down Expand Up @@ -643,6 +657,10 @@ func (ptp66 PooledTransactionsPacket66) EncodeRLP(w io.Writer) error {
if err := t.EncodeRLP(w); err != nil {
return err
}
case *types.DepositTx:
if err := t.EncodeRLP(w); err != nil {
return err
}
}
}
return nil
Expand Down

0 comments on commit e487de4

Please sign in to comment.