From 042d9206a16e6e08795249773ac440a0751c19e7 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Wed, 29 Jan 2014 01:24:05 +0000 Subject: [PATCH] change some more code over to using newer btcdb apis. --- blockmanager.go | 4 ++-- peer.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/blockmanager.go b/blockmanager.go index 86d87660..ce499745 100644 --- a/blockmanager.go +++ b/blockmanager.go @@ -284,9 +284,9 @@ func (b *blockManager) logBlockHeight(numTx, height int64, latestHash *btcwire.S // Attempt to get the timestamp of the latest block. blockTimeStr := "" - block, err := b.server.db.FetchBlockBySha(latestHash) + header, err := b.server.db.FetchBlockHeaderBySha(latestHash) if err == nil { - blockTimeStr = fmt.Sprintf(", %s", block.MsgBlock().Header.Timestamp) + blockTimeStr = fmt.Sprintf(", %s", header.Timestamp) } // Log information about new block height. diff --git a/peer.go b/peer.go index c041a1bd..7221770c 100644 --- a/peer.go +++ b/peer.go @@ -645,9 +645,9 @@ func (p *peer) handleGetBlocksMsg(msg *btcwire.MsgGetBlocks) { // Attempt to find the ending index of the stop hash if specified. endIdx := btcdb.AllShas if !msg.HashStop.IsEqual(&zeroHash) { - block, err := p.server.db.FetchBlockBySha(&msg.HashStop) + height, err := p.server.db.FetchBlockHeightBySha(&msg.HashStop) if err == nil { - endIdx = block.Height() + 1 + endIdx = height + 1 } } @@ -658,10 +658,10 @@ func (p *peer) handleGetBlocksMsg(msg *btcwire.MsgGetBlocks) { // This mirrors the behavior in the reference implementation. startIdx := int64(1) for _, hash := range msg.BlockLocatorHashes { - block, err := p.server.db.FetchBlockBySha(hash) + height, err := p.server.db.FetchBlockHeightBySha(hash) if err == nil { // Start with the next hash since we know this one. - startIdx = block.Height() + 1 + startIdx = height + 1 break } }