From 67ebfa0e80f4711bd19f99525b3c47bbfd71ad91 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 24 Mar 2014 13:14:04 -0500 Subject: [PATCH] Update checkBIP0030 to not use deprecated function. Rather than using the deprecated TxShas function on a btcutil.Block, convert the checkBIP0030 to use the newer preferred method of ranging over the Transactions to obtain the cached hash of each transaction. This is also a little more efficient since it can avoid creating and caching an extra slice to keep the hashes in addition to having the hash cached with each transaction. --- validate.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/validate.go b/validate.go index 92a73f19..717ec096 100644 --- a/validate.go +++ b/validate.go @@ -552,13 +552,9 @@ func isTransactionSpent(txD *TxData) bool { func (b *BlockChain) checkBIP0030(node *blockNode, block *btcutil.Block) error { // Attempt to fetch duplicate transactions for all of the transactions // in this block from the point of view of the parent node. - fetchList, err := block.TxShas() - if err != nil { - return nil - } fetchSet := make(map[btcwire.ShaHash]bool) - for _, txHash := range fetchList { - fetchSet[*txHash] = true + for _, tx := range block.Transactions() { + fetchSet[*tx.Sha()] = true } txResults, err := b.fetchTxStore(node, fetchSet) if err != nil {