diff --git a/blockmanager.go b/blockmanager.go index 7c9bf79e..9c635629 100644 --- a/blockmanager.go +++ b/blockmanager.go @@ -1092,7 +1092,7 @@ func (b *blockManager) handleHeadersMsg(bmsg *headersMsg) { // fetchHeaderBlocks is creates and sends a request to the syncPeer for // the next list of blocks to downloaded. func (b *blockManager) fetchHeaderBlocks() { - gdmsg := btcwire.NewMsgGetData() + gdmsg := btcwire.NewMsgGetDataSizeHint(btcwire.MaxInvPerMsg) numRequested := 0 startBlock := b.startBlock for { diff --git a/peer.go b/peer.go index 8661d78f..dd10bb9c 100644 --- a/peer.go +++ b/peer.go @@ -490,9 +490,11 @@ func (p *peer) PushGetHeadersMsg(locator btcchain.BlockLocator) error { func (p *peer) handleMemPoolMsg(msg *btcwire.MsgMemPool) { // Generate inventory message with the available transactions in the // transaction memory pool. Limit it to the max allowed inventory - // per message. - invMsg := btcwire.NewMsgInv() + // per message. The the NewMsgInvSizeHint function automatically limits + // the passed hint to the maximum allowed, so it's safe to pass it + // without double checking it here. hashes := p.server.txMemPool.TxShas() + invMsg := btcwire.NewMsgInvSizeHint(uint(len(hashes))) for i, hash := range hashes { // Another thread might have removed the transaction from the // pool since the initial query.