Source:
<code>public PaymentAccount addPaymentAccount(PaymentAccount paymentAccount) { if (paymentAccount instanceof CryptoCurrencyAccount) { CryptoCurrencyAccount cryptoCurrencyAccount = (CryptoCurrencyAccount) paymentAccount; TradeCurrency tradeCurrency = cryptoCurrencyAccount.getSingleTradeCurrency(); if (tradeCurrency == null) { <START> throw new ValidationException("CryptoCurrency account must have exactly one trade currency"); <END> } altCoinAddressValidator.setCurrencyCode(tradeCurrency.getCode()); InputValidator.ValidationResult validationResult = altCoinAddressValidator.validate(cryptoCurrencyAccount.getAddress()); if (!validationResult.isValid) { throw new ValidationException(validationResult.errorMessage); } } user.addPaymentAccount(paymentAccount); TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency(); List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies(); if (singleTradeCurrency != null) { if (singleTradeCurrency instanceof FiatCurrency) preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency); else preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency); } else if (!tradeCurrencies.isEmpty()) { tradeCurrencies.forEach(tradeCurrency -> { if (tradeCurrency instanceof FiatCurrency) preferences.addFiatCurrency((FiatCurrency) tradeCurrency); else preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency); }); } if (!(paymentAccount instanceof CryptoCurrencyAccount)) { if (singleTradeCurrency == null && !tradeCurrencies.isEmpty()) { if (tradeCurrencies.contains(CurrencyUtil.getDefaultTradeCurrency())) paymentAccount.setSelectedTradeCurrency(CurrencyUtil.getDefaultTradeCurrency()); else paymentAccount.setSelectedTradeCurrency(tradeCurrencies.get(0)); } accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload()); } return paymentAccount; }</code><technical_language>cryptoCurrencyAccount.getSingleTradeCurrency() throws exception instead returning null ? curious opinion - a change require changes in places, out of scope of current pull request</technical_language>

Target:
public PaymentAccount addPaymentAccount(PaymentAccount paymentAccount) { if (paymentAccount instanceof CryptoCurrencyAccount) { CryptoCurrencyAccount cryptoCurrencyAccount = (CryptoCurrencyAccount) paymentAccount; TradeCurrency tradeCurrency = cryptoCurrencyAccount.getSingleTradeCurrency(); if (tradeCurrency == null) { throw new ValidationException("CryptoCurrency account must have exactly one trade currency"); } altCoinAddressValidator.setCurrencyCode(tradeCurrency.getCode()); InputValidator.ValidationResult validationResult = altCoinAddressValidator.validate(cryptoCurrencyAccount.getAddress()); if (!validationResult.isValid) { throw new ValidationException(validationResult.errorMessage); } } TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency(); List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies(); if (singleTradeCurrency != null) { if (singleTradeCurrency instanceof FiatCurrency) preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency); else preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency); } else if (!tradeCurrencies.isEmpty()) { tradeCurrencies.forEach(tradeCurrency -> { if (tradeCurrency instanceof FiatCurrency) preferences.addFiatCurrency((FiatCurrency) tradeCurrency); else preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency); }); } user.addPaymentAccount(paymentAccount); if (!(paymentAccount instanceof CryptoCurrencyAccount)) { if (singleTradeCurrency == null && !tradeCurrencies.isEmpty()) { if (tradeCurrencies.contains(CurrencyUtil.getDefaultTradeCurrency())) paymentAccount.setSelectedTradeCurrency(CurrencyUtil.getDefaultTradeCurrency()); else paymentAccount.setSelectedTradeCurrency(tradeCurrencies.get(0)); } accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload()); } return paymentAccount; }