mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-05 06:28:40 +00:00
eth/protocols/eth: fix track-before-send (#35056)
Track the transaction only after it was sent out
This commit is contained in:
parent
b0df33967c
commit
10a1982203
1 changed files with 4 additions and 2 deletions
|
|
@ -159,11 +159,13 @@ func (p *Peer) MarkTransaction(hash common.Hash) {
|
||||||
// The reasons this is public is to allow packages using this protocol to write
|
// The reasons this is public is to allow packages using this protocol to write
|
||||||
// tests that directly send messages without having to do the async queueing.
|
// tests that directly send messages without having to do the async queueing.
|
||||||
func (p *Peer) SendTransactions(txs types.Transactions) error {
|
func (p *Peer) SendTransactions(txs types.Transactions) error {
|
||||||
// Mark all the transactions as known, but ensure we don't overflow our limits
|
if err := p2p.Send(p.rw, TransactionsMsg, txs); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
for _, tx := range txs {
|
for _, tx := range txs {
|
||||||
p.knownTxs.Add(tx.Hash())
|
p.knownTxs.Add(tx.Hash())
|
||||||
}
|
}
|
||||||
return p2p.Send(p.rw, TransactionsMsg, txs)
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AsyncSendTransactions queues a list of transactions (by hash) to eventually
|
// AsyncSendTransactions queues a list of transactions (by hash) to eventually
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue