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.
This commit is contained in:
parent
a55ea104c7
commit
2ae7cb8ee2
1 changed files with 4 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue