les: fix TxStatusMsg RLP coding (#15974)

This commit is contained in:
Felföldi Zsolt 2018-01-26 18:30:45 +01:00 committed by Péter Szilágyi
parent 367c329b88
commit 23bca0f374
3 changed files with 5 additions and 5 deletions

@ -1014,7 +1014,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
for i, stat := range stats { for i, stat := range stats {
if stat.Status == core.TxStatusUnknown { if stat.Status == core.TxStatusUnknown {
if errs := pm.txpool.AddRemotes([]*types.Transaction{req.Txs[i]}); errs[0] != nil { 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 continue
} }
stats[i] = pm.txStatus([]common.Hash{hashes[i]})[0] 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") p.Log().Trace("Received tx status response")
var resp struct { var resp struct {
ReqID, BV uint64 ReqID, BV uint64
Status []core.TxStatus Status []txStatus
} }
if err := msg.Decode(&resp); err != nil { if err := msg.Decode(&resp); err != nil {
return errResp(ErrDecode, "msg %v: %v", msg, err) return errResp(ErrDecode, "msg %v: %v", msg, err)

@ -444,7 +444,7 @@ func TestTransactionStatusLes2(t *testing.T) {
// test error status by sending an underpriced transaction // test error status by sending an underpriced transaction
tx0, _ := types.SignTx(types.NewTransaction(0, acc1Addr, big.NewInt(10000), params.TxGas, nil, nil), signer, testBankKey) 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) 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 test(tx1, false, txStatus{Status: core.TxStatusUnknown}) // query before sending, should be unknown

@ -224,6 +224,6 @@ type proofsData [][]rlp.RawValue
type txStatus struct { type txStatus struct {
Status core.TxStatus Status core.TxStatus
Lookup *core.TxLookupEntry Lookup *core.TxLookupEntry `rlp:"nil"`
Error error Error string
} }