Update for recent btcwire API changes.

This commit is contained in:
Dave Collins 2014-01-18 21:10:36 -06:00
parent 7ad6e235ad
commit 33bb455365
3 changed files with 5 additions and 7 deletions

View file

@ -481,12 +481,12 @@ func (b *blockManager) handleBlockMsg(bmsg *blockMsg) {
// are in the memory pool (either the main pool or orphan pool).
func (b *blockManager) haveInventory(invVect *btcwire.InvVect) bool {
switch invVect.Type {
case btcwire.InvVect_Block:
case btcwire.InvTypeBlock:
// Ask chain if the block is known to it in any form (main
// chain, side chain, or orphan).
return b.blockChain.HaveBlock(&invVect.Hash)
case btcwire.InvVect_Tx:
case btcwire.InvTypeTx:
// Ask the transaction memory pool if the transaction is known
// to it in any form (main pool or orphan).
if b.server.txMemPool.HaveTransaction(&invVect.Hash) {
@ -604,7 +604,7 @@ func (b *blockManager) handleInvMsg(imsg *invMsg) {
imsg.peer.requestQueue.Remove(e)
switch iv.Type {
case btcwire.InvVect_Block:
case btcwire.InvTypeBlock:
// Request the block if there is not already a pending
// request.
if _, exists := b.requestedBlocks[iv.Hash]; !exists {
@ -614,7 +614,7 @@ func (b *blockManager) handleInvMsg(imsg *invMsg) {
numRequested++
}
case btcwire.InvVect_Tx:
case btcwire.InvTypeTx:
// Request the transaction if there is not already a
// pending request.
if _, exists := b.requestedTxns[iv.Hash]; !exists {

2
log.go
View file

@ -286,7 +286,7 @@ func messageSummary(msg btcwire.Message) string {
header := &msg.Header
hash, _ := msg.BlockSha()
return fmt.Sprintf("hash %s, ver %d, %d tx, %s", hash,
header.Version, header.TxnCount, header.Timestamp)
header.Version, len(msg.Transactions), header.Timestamp)
case *btcwire.MsgInv:
return invSummary(msg.InvList)

View file

@ -740,7 +740,6 @@ func (p *peer) handleGetHeadersMsg(msg *btcwire.MsgGetHeaders) {
// Send the requested block header.
headersMsg := btcwire.NewMsgHeaders()
hdr := block.MsgBlock().Header // copy
hdr.TxnCount = 0
headersMsg.AddBlockHeader(&hdr)
p.QueueMessage(headersMsg, nil)
return
@ -796,7 +795,6 @@ func (p *peer) handleGetHeadersMsg(msg *btcwire.MsgGetHeaders) {
continue
}
hdr := block.MsgBlock().Header // copy
hdr.TxnCount = 0
headersMsg.AddBlockHeader(&hdr)
}