Fixed bitocin balance

This commit is contained in:
hvarona 2018-11-21 22:42:59 -04:00
parent 469e7b08e4
commit 93e71887a8

View file

@ -280,11 +280,11 @@ public class GeneralAccountManager implements CryptoAccountManager, CryptoNetInf
} }
ccTransaction.setAmount(amount); ccTransaction.setAmount(amount);
CryptoCurrency currency = db.cryptoCurrencyDao().getByNameAndCryptoNet(this.cryptoCoin.name(), this.cryptoCoin.getCryptoNet().name()); CryptoCurrency currency = db.cryptoCurrencyDao().getByNameAndCryptoNet(this.cryptoCoin.getLabel(), this.cryptoCoin.getCryptoNet().name());
if (currency == null) { if (currency == null) {
currency = new CryptoCurrency(); currency = new CryptoCurrency();
currency.setCryptoNet(this.cryptoCoin.getCryptoNet()); currency.setCryptoNet(this.cryptoCoin.getCryptoNet());
currency.setName(this.cryptoCoin.name()); currency.setName(this.cryptoCoin.getLabel());
currency.setPrecision(this.cryptoCoin.getPrecision()); currency.setPrecision(this.cryptoCoin.getPrecision());
long idCurrency = db.cryptoCurrencyDao().insertCryptoCurrency(currency)[0]; long idCurrency = db.cryptoCurrencyDao().insertCryptoCurrency(currency)[0];
currency.setId(idCurrency); currency.setId(idCurrency);
@ -325,11 +325,11 @@ public class GeneralAccountManager implements CryptoAccountManager, CryptoNetInf
} }
private void updateBalance(CryptoCoinTransaction ccTransaction, long amount, CrystalDatabase db){ private void updateBalance(CryptoCoinTransaction ccTransaction, long amount, CrystalDatabase db){
CryptoCurrency currency = db.cryptoCurrencyDao().getByNameAndCryptoNet(this.cryptoCoin.name(), this.cryptoCoin.getCryptoNet().name()); CryptoCurrency currency = db.cryptoCurrencyDao().getByNameAndCryptoNet(this.cryptoCoin.getLabel(), this.cryptoCoin.getCryptoNet().name());
if (currency == null) { if (currency == null) {
currency = new CryptoCurrency(); currency = new CryptoCurrency();
currency.setCryptoNet(this.cryptoCoin.getCryptoNet()); currency.setCryptoNet(this.cryptoCoin.getCryptoNet());
currency.setName(this.cryptoCoin.name()); currency.setName(this.cryptoCoin.getLabel());
currency.setPrecision(this.cryptoCoin.getPrecision()); currency.setPrecision(this.cryptoCoin.getPrecision());
long idCurrency = db.cryptoCurrencyDao().insertCryptoCurrency(currency)[0]; long idCurrency = db.cryptoCurrencyDao().insertCryptoCurrency(currency)[0];
currency.setId(idCurrency); currency.setId(idCurrency);