Code Duplication    Length = 11-11 lines in 2 locations

src/WalletSweeper.php 1 location

@@ 212-222 (lines=11) @@
209
     * @return BIP32Key
210
     * @throws \Exception
211
     */
212
    protected function getBlocktrailPublicKey($path) {
213
        $path = BIP32Path::path($path);
214
215
        $keyIndex = str_replace("'", "", $path[1]);
216
217
        if (!isset($this->blocktrailPublicKeys[$keyIndex])) {
218
            throw new \Exception("No blocktrail publickey for key index [{$keyIndex}]");
219
        }
220
221
        return $this->blocktrailPublicKeys[$keyIndex];
222
    }
223
224
    /**
225
     * discover funds in the wallet

src/Wallet.php 1 location

@@ 442-452 (lines=11) @@
439
     * @return BIP32Key
440
     * @throws \Exception
441
     */
442
    public function getBlocktrailPublicKey($path) {
443
        $path = BIP32Path::path($path);
444
445
        $keyIndex = str_replace("'", "", $path[1]);
446
447
        if (!isset($this->blocktrailPublicKeys[$keyIndex])) {
448
            throw new \Exception("No blocktrail publickey for key index [{$keyIndex}]");
449
        }
450
451
        return $this->blocktrailPublicKeys[$keyIndex];
452
    }
453
454
    /**
455
     * generate a new derived key and return the new path and address for it