btcd
btcd copied to clipboard
mempool,txscript: avoid big array copies in for-range
When array is used in place of range expression, whole array is copied. Using &array avoids this issue.
Found using https://go-critic.github.io/overview#rangeExprCopy-ref
Linter output:
$GOPATH/src/github.com/btcsuite/btcd/mempool/estimatefee.go:513:2: rangeExprCopy: copy of ef.bin (600 bytes) can be avoided with &ef.bin
$GOPATH/src/github.com/btcsuite/btcd/mempool/estimatefee.go:522:2: rangeExprCopy: copy of ef.bin (600 bytes) can be avoided with &ef.bin
$GOPATH/src/github.com/btcsuite/btcd/mempool/estimatefee.go:659:2: rangeExprCopy: copy of ef.bin (600 bytes) can be avoided with &ef.bin
$GOPATH/src/github.com/btcsuite/btcd/txscript/opcode.go:2440:2: rangeExprCopy: copy of opcodeArray (10240 bytes) can be avoided with &opcodeArray
@jcvernaleo (as per #1530)
- Low priority
- Enhancement
Can you rebase or force-push so CI can run?