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