diff options
author | Felföldi Zsolt <zsfelfoldi@gmail.com> | 2019-05-13 19:41:10 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-05-13 19:41:10 +0800 |
commit | 40cdcf8c47ff094775aca08fd5d94051f9cf1dbb (patch) | |
tree | 3a9fc715ec501ab0fec8c81004e17477bd136f9f /les/handler.go | |
parent | f4fb1a18015d88aa7b424709aac346da59edf410 (diff) | |
download | go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.tar go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.tar.gz go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.tar.bz2 go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.tar.lz go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.tar.xz go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.tar.zst go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.zip |
les, light: implement ODR transaction lookup by hash (#19069)
* les, light: implement ODR transaction lookup by hash
* les: delete useless file
* internal/ethapi: always use backend to find transaction
* les, eth, internal/ethapi: renamed GetCanonicalTransaction to GetTransaction
* light: add canonical header verification to GetTransaction
Diffstat (limited to 'les/handler.go')
-rw-r--r-- | les/handler.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/les/handler.go b/les/handler.go index d46eeb03a..c6baeece4 100644 --- a/les/handler.go +++ b/les/handler.go @@ -979,7 +979,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { return errResp(ErrRequestRejected, "") } go func() { - stats := make([]txStatus, len(req.Txs)) + stats := make([]light.TxStatus, len(req.Txs)) for i, tx := range req.Txs { if i != 0 && !task.waitOrStop() { return @@ -1014,7 +1014,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { return errResp(ErrRequestRejected, "") } go func() { - stats := make([]txStatus, len(req.Hashes)) + stats := make([]light.TxStatus, len(req.Hashes)) for i, hash := range req.Hashes { if i != 0 && !task.waitOrStop() { return @@ -1032,7 +1032,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { p.Log().Trace("Received tx status response") var resp struct { ReqID, BV uint64 - Status []txStatus + Status []light.TxStatus } if err := msg.Decode(&resp); err != nil { return errResp(ErrDecode, "msg %v: %v", msg, err) @@ -1040,6 +1040,13 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { p.fcServer.ReceivedReply(resp.ReqID, resp.BV) + p.Log().Trace("Received helper trie proof response") + deliverMsg = &Msg{ + MsgType: MsgTxStatus, + ReqID: resp.ReqID, + Obj: resp.Status, + } + default: p.Log().Trace("Received unknown message", "code", msg.Code) return errResp(ErrInvalidMsgCode, "%v", msg.Code) @@ -1097,8 +1104,8 @@ func (pm *ProtocolManager) getHelperTrieAuxData(req HelperTrieReq) []byte { return nil } -func (pm *ProtocolManager) txStatus(hash common.Hash) txStatus { - var stat txStatus +func (pm *ProtocolManager) txStatus(hash common.Hash) light.TxStatus { + var stat light.TxStatus stat.Status = pm.txpool.Status([]common.Hash{hash})[0] // If the transaction is unknown to the pool, try looking it up locally if stat.Status == core.TxStatusUnknown { |