From 23bca0f374b3e1ccfa19bfeb86d06a0aca82184b Mon Sep 17 00:00:00 2001 From: Felföldi Zsolt Date: Fri, 26 Jan 2018 18:30:45 +0100 Subject: les: fix TxStatusMsg RLP coding (#15974) --- les/handler.go | 4 ++-- les/handler_test.go | 2 +- les/protocol.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'les') diff --git a/les/handler.go b/les/handler.go index d627c3e18..57657e84f 100644 --- a/les/handler.go +++ b/les/handler.go @@ -1014,7 +1014,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { for i, stat := range stats { if stat.Status == core.TxStatusUnknown { if errs := pm.txpool.AddRemotes([]*types.Transaction{req.Txs[i]}); errs[0] != nil { - stats[i].Error = errs[0] + stats[i].Error = errs[0].Error() continue } stats[i] = pm.txStatus([]common.Hash{hashes[i]})[0] @@ -1055,7 +1055,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { p.Log().Trace("Received tx status response") var resp struct { ReqID, BV uint64 - Status []core.TxStatus + Status []txStatus } if err := msg.Decode(&resp); err != nil { return errResp(ErrDecode, "msg %v: %v", msg, err) diff --git a/les/handler_test.go b/les/handler_test.go index 7d67af26a..10e5499a3 100644 --- a/les/handler_test.go +++ b/les/handler_test.go @@ -444,7 +444,7 @@ func TestTransactionStatusLes2(t *testing.T) { // test error status by sending an underpriced transaction tx0, _ := types.SignTx(types.NewTransaction(0, acc1Addr, big.NewInt(10000), params.TxGas, nil, nil), signer, testBankKey) - test(tx0, true, txStatus{Status: core.TxStatusUnknown, Error: core.ErrUnderpriced}) + test(tx0, true, txStatus{Status: core.TxStatusUnknown, Error: core.ErrUnderpriced.Error()}) tx1, _ := types.SignTx(types.NewTransaction(0, acc1Addr, big.NewInt(10000), params.TxGas, big.NewInt(100000000000), nil), signer, testBankKey) test(tx1, false, txStatus{Status: core.TxStatusUnknown}) // query before sending, should be unknown diff --git a/les/protocol.go b/les/protocol.go index 6a7354d1c..e1c4625bc 100644 --- a/les/protocol.go +++ b/les/protocol.go @@ -224,6 +224,6 @@ type proofsData [][]rlp.RawValue type txStatus struct { Status core.TxStatus - Lookup *core.TxLookupEntry - Error error + Lookup *core.TxLookupEntry `rlp:"nil"` + Error string } -- cgit