From 9b677402507aec3baf625fb4f9cb70934e152b96 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Thu, 28 Apr 2022 15:17:44 +0700 Subject: [PATCH 1/2] save --- ethdb/privateapi/txpool.go | 6 ++---- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ethdb/privateapi/txpool.go b/ethdb/privateapi/txpool.go index 6957d9ba47d..6a61b27b2d5 100644 --- a/ethdb/privateapi/txpool.go +++ b/ethdb/privateapi/txpool.go @@ -46,14 +46,13 @@ 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, }) @@ -61,14 +60,13 @@ func (s *TxPoolServer) All(context.Context, *proto_txpool.AllRequest) (*proto_tx } 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, }) diff --git a/go.mod b/go.mod index 5e90bb29da5..800d5a5bfc2 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index d42265115ed..2c861e1d8b8 100644 --- a/go.sum +++ b/go.sum @@ -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= From 3ccf6c0ff48806e16fc06e5b475c6b6302bf928d Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Thu, 28 Apr 2022 15:26:14 +0700 Subject: [PATCH 2/2] save --- cmd/rpcdaemon/commands/txpool_api.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/rpcdaemon/commands/txpool_api.go b/cmd/rpcdaemon/commands/txpool_api.go index 60a6dc432d4..eccb66bc4f5 100644 --- a/cmd/rpcdaemon/commands/txpool_api.go +++ b/cmd/rpcdaemon/commands/txpool_api.go @@ -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" @@ -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 {