fixed api.blockWithSenders (#3435)

* fix

* fix 2

* fixed api.blockWithSenders

* removed white space

* pretty
This commit is contained in:
Giulio rebuffo 2022-02-05 20:11:56 +01:00 committed by GitHub
parent 4da9a663f8
commit 1602842a63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -432,10 +432,10 @@ func (rs Receipts) EncodeIndex(i int, w *bytes.Buffer) {
func (r Receipts) DeriveFields(hash common.Hash, number uint64, txs Transactions, senders []common.Address) error {
logIndex := uint(0) // logIdx is unique within the block and starts from 0
if len(txs) != len(r) {
return errors.New("transaction and receipt count mismatch")
return fmt.Errorf("transaction and receipt count mismatch, tx count = %d, receipts count = %d", len(txs), len(r))
}
if len(senders) != len(txs) {
return errors.New("transaction and senders count mismatch")
return fmt.Errorf("transaction and senders count mismatch, tx count = %d, receipts count = %d", len(txs), len(r))
}
for i := 0; i < len(r); i++ {
// The transaction type and hash can be retrieved from the transaction itself

View File

@ -216,8 +216,8 @@ func (s *EthBackendServer) Block(ctx context.Context, req *remote.BlockRequest)
return nil, err
}
sendersBytes := make([]byte, 20*len(senders))
for i := range senders {
sendersBytes = append(sendersBytes, senders[i][:]...)
for i, sender := range senders {
copy(sendersBytes[i*20:], sender[:])
}
return &remote.BlockReply{BlockRlp: blockRlp, Senders: sendersBytes}, nil
}