mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-13 11:35:40 +01:00
core: Fix bug when converting OP_0 to long (#5948)
This commit is contained in:
parent
c6d83199bf
commit
ed66937d01
1 changed files with 4 additions and 1 deletions
|
@ -54,7 +54,10 @@ trait ScriptNumberUtil {
|
|||
*/
|
||||
def toLong(bytes: ByteVector): Long = {
|
||||
val reversedBytes = bytes.reverse
|
||||
if (bytes.size == 1 && bytes.head == -128) {
|
||||
|
||||
if (bytes.isEmpty) {
|
||||
0
|
||||
} else if (bytes.size == 1 && bytes.head == -128) {
|
||||
// the case for negative zero
|
||||
0
|
||||
} else if (isPositive(bytes)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue