btcd: fix error in mempool response inv counting

This commit is contained in:
Steven Roose 2016-11-25 10:30:24 +01:00
parent afec1bd124
commit 95e6de00b8

View file

@ -385,14 +385,14 @@ func (sp *serverPeer) OnMemPool(_ *peer.Peer, msg *wire.MsgMemPool) {
txDescs := txMemPool.TxDescs() txDescs := txMemPool.TxDescs()
invMsg := wire.NewMsgInvSizeHint(uint(len(txDescs))) invMsg := wire.NewMsgInvSizeHint(uint(len(txDescs)))
for i, txDesc := range txDescs { for _, txDesc := range txDescs {
// Either add all transactions when there is no bloom filter, // Either add all transactions when there is no bloom filter,
// or only the transactions that match the filter when there is // or only the transactions that match the filter when there is
// one. // one.
if !sp.filter.IsLoaded() || sp.filter.MatchTxAndUpdate(txDesc.Tx) { if !sp.filter.IsLoaded() || sp.filter.MatchTxAndUpdate(txDesc.Tx) {
iv := wire.NewInvVect(wire.InvTypeTx, txDesc.Tx.Hash()) iv := wire.NewInvVect(wire.InvTypeTx, txDesc.Tx.Hash())
invMsg.AddInvVect(iv) invMsg.AddInvVect(iv)
if i+1 >= wire.MaxInvPerMsg { if len(invMsg.InvList)+1 > wire.MaxInvPerMsg {
break break
} }
} }