Update Transaction.isCoinbaseHash
- add argument type-checking - replace Array.every on for-loop
This commit is contained in:
parent
a3ec53e2d8
commit
8ddcf737f9
1 changed files with 5 additions and 3 deletions
|
@ -82,9 +82,11 @@ Transaction.fromHex = function (hex) {
|
|||
}
|
||||
|
||||
Transaction.isCoinbaseHash = function (buffer) {
|
||||
return Array.prototype.every.call(buffer, function (x) {
|
||||
return x === 0
|
||||
})
|
||||
typeforce(types.Hash256bit, buffer)
|
||||
for (var i = 0; i < 32; ++i) {
|
||||
if (buffer[i] !== 0) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Transaction.prototype.isCoinbase = function () {
|
||||
|
|
Loading…
Reference in a new issue