@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | rewind($stream); |
55 | 55 | |
56 | 56 | return $segwit ? |
57 | - self::parseSegWit($stream, $mode) : |
|
58 | - self::parseLegacy($stream, $mode); |
|
57 | + self::parseSegWit($stream, $mode) : self::parseLegacy($stream, $mode); |
|
59 | 58 | } |
60 | 59 | |
61 | 60 | public function serialize(): string |
@@ -74,8 +73,7 @@ discard block |
||
74 | 73 | $witness .= Encoding::encodeVarInt(\count($txIn->witness)); |
75 | 74 | foreach ($txIn->witness as $element) { |
76 | 75 | $witness .= \is_int($element) ? |
77 | - Encoding::toLE(gmp_init($element)) : |
|
78 | - Encoding::encodeVarInt(\strlen($element)).$element; |
|
76 | + Encoding::toLE(gmp_init($element)) : Encoding::encodeVarInt(\strlen($element)).$element; |
|
79 | 77 | } |
80 | 78 | } |
81 | 79 | } |
@@ -97,12 +95,12 @@ discard block |
||
97 | 95 | |
98 | 96 | public function isCoinbase(): bool |
99 | 97 | { |
100 | - return 1 === \count($this->txIns) |
|
98 | + return 1 === \count($this->txIns) |
|
101 | 99 | && '0000000000000000000000000000000000000000000000000000000000000000' === $this->txIns[0]->prevTxId |
102 | - && 0xFFFFFFFF === $this->txIns[0]->prevIndex; |
|
100 | + && 0xFFFFFFFF === $this->txIns[0]->prevIndex; |
|
103 | 101 | } |
104 | 102 | |
105 | - public function blockHeight(): int|false |
|
103 | + public function blockHeight(): int | false |
|
106 | 104 | { |
107 | 105 | if (!$this->isCoinbase()) { |
108 | 106 | return false; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | return new static($x, $y); |
71 | 71 | } |
72 | 72 | |
73 | - public function scalarMul(\GMP|int $coefficient): self |
|
73 | + public function scalarMul(\GMP | int $coefficient): self |
|
74 | 74 | { |
75 | 75 | // Optimization: reduce the coefficient modulo N before computing the multiplication |
76 | 76 | $c = $coefficient % S256Params::N(); |
@@ -114,8 +114,7 @@ discard block |
||
114 | 114 | $beta = $alpha->sqrt(); |
115 | 115 | |
116 | 116 | return "\x02" === $sec[0] ? |
117 | - new self($x, (0 == $beta->num % 2) ? $beta : new S256Field(S256Params::P() - $beta->num)) : |
|
118 | - new self($x, (0 == $beta->num % 2) ? new S256Field(S256Params::P() - $beta->num) : $beta); |
|
117 | + new self($x, (0 == $beta->num % 2) ? $beta : new S256Field(S256Params::P() - $beta->num)) : new self($x, (0 == $beta->num % 2) ? new S256Field(S256Params::P() - $beta->num) : $beta); |
|
119 | 118 | } |
120 | 119 | |
121 | 120 | public function address(bool $compressed = true, Network $mode = Network::TESTNET): string |
@@ -138,7 +137,7 @@ discard block |
||
138 | 137 | { |
139 | 138 | $sInv = gmp_powm($sig->s, S256Params::N() - 2, S256Params::N()); |
140 | 139 | |
141 | - $u = ($z * $sInv) % S256Params::N(); |
|
140 | + $u = ($z * $sInv) % S256Params::N(); |
|
142 | 141 | $v = ($sig->r * $sInv) % S256Params::N(); |
143 | 142 | |
144 | 143 | $R = S256Params::G()->scalarMul($u)->add($this->scalarMul($v)); |