Skip to content

Commit 23bca0f

Browse files
zsfelfoldikaralabe
authored andcommitted
les: fix TxStatusMsg RLP coding (#15974)
1 parent 367c329 commit 23bca0f

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎les/handler.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
10141014
for i, stat := range stats {
10151015
if stat.Status == core.TxStatusUnknown {
10161016
if errs := pm.txpool.AddRemotes([]*types.Transaction{req.Txs[i]}); errs[0] != nil {
1017-
stats[i].Error = errs[0]
1017+
stats[i].Error = errs[0].Error()
10181018
continue
10191019
}
10201020
stats[i] = pm.txStatus([]common.Hash{hashes[i]})[0]
@@ -1055,7 +1055,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
10551055
p.Log().Trace("Received tx status response")
10561056
var resp struct {
10571057
ReqID, BV uint64
1058-
Status []core.TxStatus
1058+
Status []txStatus
10591059
}
10601060
if err := msg.Decode(&resp); err != nil {
10611061
return errResp(ErrDecode, "msg %v: %v", msg, err)

‎les/handler_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ func TestTransactionStatusLes2(t *testing.T) {
444444

445445
// test error status by sending an underpriced transaction
446446
tx0, _ := types.SignTx(types.NewTransaction(0, acc1Addr, big.NewInt(10000), params.TxGas, nil, nil), signer, testBankKey)
447-
test(tx0, true, txStatus{Status: core.TxStatusUnknown, Error: core.ErrUnderpriced})
447+
test(tx0, true, txStatus{Status: core.TxStatusUnknown, Error: core.ErrUnderpriced.Error()})
448448

449449
tx1, _ := types.SignTx(types.NewTransaction(0, acc1Addr, big.NewInt(10000), params.TxGas, big.NewInt(100000000000), nil), signer, testBankKey)
450450
test(tx1, false, txStatus{Status: core.TxStatusUnknown}) // query before sending, should be unknown

‎les/protocol.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,6 @@ type proofsData [][]rlp.RawValue
224224

225225
type txStatus struct {
226226
Status core.TxStatus
227-
Lookup *core.TxLookupEntry
228-
Error error
227+
Lookup *core.TxLookupEntry `rlp:"nil"`
228+
Error string
229229
}

0 commit comments

Comments
 (0)