mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core, eth: Only show rejections if err is not nil
This commit is contained in:
parent
4eab5b8213
commit
2791b22d83
2 changed files with 12 additions and 6 deletions
|
|
@ -853,10 +853,12 @@ func (pool *TxPool) addTxs(txs []*types.Transaction, local, sync bool) []error {
|
||||||
for errs[nilSlot] != nil {
|
for errs[nilSlot] != nil {
|
||||||
nilSlot++
|
nilSlot++
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
pool.rejectTxFeed.Send(RejectedTxEvent{
|
pool.rejectTxFeed.Send(RejectedTxEvent{
|
||||||
Tx: txs[nilSlot],
|
Tx: txs[nilSlot],
|
||||||
Reason: err,
|
Reason: err,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
errs[nilSlot] = err
|
errs[nilSlot] = err
|
||||||
}
|
}
|
||||||
// Reorg the pool internals if needed and return
|
// Reorg the pool internals if needed and return
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ type dropNotification struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type rejectNotification struct {
|
type rejectNotification struct {
|
||||||
Tx *types.Transaction
|
Tx *types.Transaction `json:"tx"`
|
||||||
Reason string `json:"reason"`
|
Reason string `json:"reason"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,7 +67,11 @@ func (api *PublicFilterAPI) RejectedTransactions(ctx context.Context) (*rpc.Subs
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case d := <-rejected:
|
case d := <-rejected:
|
||||||
notifier.Notify(rpcSub.ID, &rejectNotification{Tx: d.Tx, Reason: d.Reason.Error()})
|
reason := ""
|
||||||
|
if d.Reason != nil {
|
||||||
|
reason = d.Reason.Error()
|
||||||
|
}
|
||||||
|
notifier.Notify(rpcSub.ID, &rejectNotification{Tx: d.Tx, Reason: reason})
|
||||||
case <-rpcSub.Err():
|
case <-rpcSub.Err():
|
||||||
rejectedSub.Unsubscribe()
|
rejectedSub.Unsubscribe()
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue