| @@ 82-102 (lines=21) @@ | ||
| 79 | * @return array |
|
| 80 | * @throws \Exception |
|
| 81 | */ |
|
| 82 | protected function normalizeNetwork($network, $testnet) { |
|
| 83 | switch (strtolower($network)) { |
|
| 84 | case 'btc': |
|
| 85 | case 'bitcoin': |
|
| 86 | $network = 'bitcoin'; |
|
| 87 | ||
| 88 | break; |
|
| 89 | ||
| 90 | case 'tbtc': |
|
| 91 | case 'bitcoin-testnet': |
|
| 92 | $network = 'bitcoin'; |
|
| 93 | $testnet = true; |
|
| 94 | ||
| 95 | break; |
|
| 96 | ||
| 97 | default: |
|
| 98 | throw new \Exception("Unknown network [{$network}]"); |
|
| 99 | } |
|
| 100 | ||
| 101 | return [$network, $testnet]; |
|
| 102 | } |
|
| 103 | ||
| 104 | /** |
|
| 105 | * set BitcoinLib to the correct magic-byte defaults for the selected network |
|
| @@ 123-143 (lines=21) @@ | ||
| 120 | * @return array |
|
| 121 | * @throws \Exception |
|
| 122 | */ |
|
| 123 | protected function normalizeNetwork($network, $testnet) { |
|
| 124 | switch (strtolower($network)) { |
|
| 125 | case 'btc': |
|
| 126 | case 'bitcoin': |
|
| 127 | $network = 'bitcoin'; |
|
| 128 | ||
| 129 | break; |
|
| 130 | ||
| 131 | case 'tbtc': |
|
| 132 | case 'bitcoin-testnet': |
|
| 133 | $network = 'bitcoin'; |
|
| 134 | $testnet = true; |
|
| 135 | ||
| 136 | break; |
|
| 137 | ||
| 138 | default: |
|
| 139 | throw new \Exception("Unknown network [{$network}]"); |
|
| 140 | } |
|
| 141 | ||
| 142 | return [$network, $testnet]; |
|
| 143 | } |
|
| 144 | ||
| 145 | ||
| 146 | /** |
|