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 {
|
if !c.VerboseTx {
|
||||||
txList, _ := blk.TxShas()
|
transactions := blk.Transactions()
|
||||||
|
txNames := make([]string, len(transactions))
|
||||||
txNames := make([]string, len(txList))
|
for i, tx := range transactions {
|
||||||
for i, v := range txList {
|
txNames[i] = tx.Sha().String()
|
||||||
txNames[i] = v.String()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blockReply.Tx = txNames
|
blockReply.Tx = txNames
|
||||||
|
|
Loading…
Reference in a new issue