From 33bb455365c039a35b46a4e5355a5abaacadbfe8 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sat, 18 Jan 2014 21:10:36 -0600 Subject: [PATCH] Update for recent btcwire API changes. --- blockmanager.go | 8 ++++---- log.go | 2 +- peer.go | 2 -- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/blockmanager.go b/blockmanager.go index 688da09b..f5db49eb 100644 --- a/blockmanager.go +++ b/blockmanager.go @@ -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 { diff --git a/log.go b/log.go index 6bc77cd4..35b51374 100644 --- a/log.go +++ b/log.go @@ -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) diff --git a/peer.go b/peer.go index 65c73dad..d9cf7f4f 100644 --- a/peer.go +++ b/peer.go @@ -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) }