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.
This commit is contained in:
parent
96f9b88935
commit
67ebfa0e80
1 changed files with 2 additions and 6 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue