Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions les/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an odd one. Why change this? Is this a network protocol packet? If so, don't we have it declared already in protocol.go. If not, perhaps we should? Just wondering here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a protocol packet and it is declared in protocol.go. Before the cleanup there was no les.txStatus, just core.TxStatus which contained the position and error fields too. When les.txStatus was created, we forgot to replace this instance (another reason the whole thing wasn't working).

}
if err := msg.Decode(&resp); err != nil {
return errResp(ErrDecode, "msg %v: %v", msg, err)
Expand Down
2 changes: 1 addition & 1 deletion les/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions les/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}