diff options
author | Péter Szilágyi <peterke@gmail.com> | 2019-04-10 20:45:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-10 20:45:13 +0800 |
commit | cdae1c59abc32f85debfa29577fbf1ed036ebf73 (patch) | |
tree | 1cead73084658ee9b15288d6ecab07bbf37cf90c /les/txrelay.go | |
parent | 14ae1246b789dd2a0a2bd22f0c7d3256daa26759 (diff) | |
parent | 0b00e19ed93512865dccdef1a340c27e6985aa82 (diff) | |
download | go-tangerine-1.8.26.tar go-tangerine-1.8.26.tar.gz go-tangerine-1.8.26.tar.bz2 go-tangerine-1.8.26.tar.lz go-tangerine-1.8.26.tar.xz go-tangerine-1.8.26.tar.zst go-tangerine-1.8.26.zip |
Merge pull request #19437 from zsfelfoldi/fix-sendtxv1.8.26
les: fix SendTx cost calculation and verify cost table
Diffstat (limited to 'les/txrelay.go')
-rw-r--r-- | les/txrelay.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/les/txrelay.go b/les/txrelay.go index 7a02cc837..5decd6e93 100644 --- a/les/txrelay.go +++ b/les/txrelay.go @@ -21,6 +21,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/rlp" ) type ltrInfo struct { @@ -113,21 +114,22 @@ func (self *LesTxRelay) send(txs types.Transactions, count int) { for p, list := range sendTo { pp := p ll := list + enc, _ := rlp.EncodeToBytes(ll) reqID := genReqID() rq := &distReq{ getCost: func(dp distPeer) uint64 { peer := dp.(*peer) - return peer.GetRequestCost(SendTxMsg, len(ll)) + return peer.GetTxRelayCost(len(ll), len(enc)) }, canSend: func(dp distPeer) bool { return dp.(*peer) == pp }, request: func(dp distPeer) func() { peer := dp.(*peer) - cost := peer.GetRequestCost(SendTxMsg, len(ll)) + cost := peer.GetTxRelayCost(len(ll), len(enc)) peer.fcServer.QueueRequest(reqID, cost) - return func() { peer.SendTxs(reqID, cost, ll) } + return func() { peer.SendTxs(reqID, cost, enc) } }, } self.reqDist.queue(rq) |