From 2ae7cb8ee2a67adfbf9971677ff081415cb24c9c Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 24 Mar 2014 13:18:27 -0500 Subject: [PATCH] Update handleGetBlock to not use deprecated func. Rather than using the deprecated TxShas function on a btcutil.Block, convert handleGetBlock to use the newer preferred method of ranging over the Transactions to obtain the cached hash of each transaction. This is 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. --- rpcserver.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index 6a5c82b1..dfa6fdec 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -911,11 +911,10 @@ func handleGetBlock(s *rpcServer, cmd btcjson.Cmd) (interface{}, error) { } if !c.VerboseTx { - txList, _ := blk.TxShas() - - txNames := make([]string, len(txList)) - for i, v := range txList { - txNames[i] = v.String() + transactions := blk.Transactions() + txNames := make([]string, len(transactions)) + for i, tx := range transactions { + txNames[i] = tx.Sha().String() } blockReply.Tx = txNames