Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typed sender #4016

Merged
merged 2 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/rpcdaemon/commands/txpool_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"fmt"

"github.com/ledgerwatch/erigon-lib/gointerfaces"
proto_txpool "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/common"
Expand Down Expand Up @@ -56,7 +57,7 @@ func (api *TxPoolAPIImpl) Content(ctx context.Context) (map[string]map[string]ma
if err != nil {
return nil, err
}
addr := common.BytesToAddress(reply.Txs[i].Sender)
addr := gointerfaces.ConvertH160toAddress(reply.Txs[i].Sender)
switch reply.Txs[i].TxnType {
case proto_txpool.AllReply_PENDING:
if _, ok := pending[addr]; !ok {
Expand Down
6 changes: 2 additions & 4 deletions ethdb/privateapi/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,27 @@ func (s *TxPoolServer) All(context.Context, *proto_txpool.AllRequest) (*proto_tx
reply := &proto_txpool.AllReply{}
reply.Txs = make([]*proto_txpool.AllReply_Tx, 0, 32)
for addr, list := range pending {
addrBytes := addr.Bytes()
for i := range list {
b, err := rlp.EncodeToBytes(list[i])
if err != nil {
return nil, err
}
reply.Txs = append(reply.Txs, &proto_txpool.AllReply_Tx{
Sender: addrBytes,
Sender: gointerfaces.ConvertAddressToH160(addr),
TxnType: proto_txpool.AllReply_PENDING,
RlpTx: b,
})
}
}

for addr, list := range queued {
addrBytes := addr.Bytes()
for i := range list {
b, err := rlp.EncodeToBytes(list[i])
if err != nil {
return nil, err
}
reply.Txs = append(reply.Txs, &proto_txpool.AllReply_Tx{
Sender: addrBytes,
Sender: gointerfaces.ConvertAddressToH160(addr),
TxnType: proto_txpool.AllReply_QUEUED,
RlpTx: b,
})
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
github.com/json-iterator/go v1.1.12
github.com/julienschmidt/httprouter v1.3.0
github.com/kevinburke/go-bindata v3.21.0+incompatible
github.com/ledgerwatch/erigon-lib v0.0.0-20220428075533-47ef59e2157e
github.com/ledgerwatch/erigon-lib v0.0.0-20220428081615-a38867fd26d9
github.com/ledgerwatch/log/v3 v3.4.1
github.com/ledgerwatch/secp256k1 v1.0.0
github.com/pelletier/go-toml v1.9.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758 h1:0D5M2HQSGD3P
github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/ledgerwatch/erigon-lib v0.0.0-20220428075533-47ef59e2157e h1:PncTET2FyVA1PQM+K4vL3Q2Pk1d/iw6yEJfMLkGUZhA=
github.com/ledgerwatch/erigon-lib v0.0.0-20220428075533-47ef59e2157e/go.mod h1:Z6hOzGMPdbzDcCs+EV5CEl/a6zOpgXqXL0K5956iXUc=
github.com/ledgerwatch/erigon-lib v0.0.0-20220428081615-a38867fd26d9 h1:2z418bsPbSZvak1iReN0grVYub4b0TNcWVldcLs9xTA=
github.com/ledgerwatch/erigon-lib v0.0.0-20220428081615-a38867fd26d9/go.mod h1:Z6hOzGMPdbzDcCs+EV5CEl/a6zOpgXqXL0K5956iXUc=
github.com/ledgerwatch/log/v3 v3.4.1 h1:/xGwlVulXnsO9Uq+tzaExc8OWmXXHU0dnLalpbnY5Bc=
github.com/ledgerwatch/log/v3 v3.4.1/go.mod h1:VXcz6Ssn6XEeU92dCMc39/g1F0OYAjw1Mt+dGP5DjXY=
github.com/ledgerwatch/secp256k1 v1.0.0 h1:Usvz87YoTG0uePIV8woOof5cQnLXGYa162rFf3YnwaQ=
Expand Down