modify create or import HDAccount
MODIFY
bither-android/src/net/bither/fragment/cold/AddAddressBitpieColdHDAccountFragment.java
bither-android/src/net/bither/fragment/cold/AddAddressBitpieColdHDAccountFragment.java
@@ -136,12 +136,6 @@ public class AddAddressBitpieColdHDAccountFragment extends Fragment implements A
try {
hdAccount = new BitpieHDAccountCold(MnemonicCode.instance(), new SecureRandom(), password);
final List<String> words = hdAccount.getSeedWords(password);
- String firstAddress = HDAccount.getFirstAddress(words);
- String dbFirstAddress = hdAccount.getFirstAddressFromDb();
- if (!firstAddress.equals(dbFirstAddress)) {
- onFailed(password);
- return;
- }
password.wipe();
BackupUtil.backupColdKey(false);
if (service != null) {
@@ -182,14 +176,7 @@ public class AddAddressBitpieColdHDAccountFragment extends Fragment implements A
};
void onFailed(SecureCharSequence password) {
- if (AddressManager.getInstance().noAddress()) {
- AbstractDb.addressProvider.deletePassword(password);
- }
password.wipe();
- if (hdAccount != null) {
- AbstractDb.hdAccountProvider.deleteHDAccount(hdAccount.getHdSeedId());
- AbstractDb.hdAccountAddressProvider.deleteHDAccountAddress(hdAccount.getHdSeedId());
- }
ThreadUtil.runOnMainThread(new Runnable() {
@Override
public void run() {

MODIFY
bither-android/src/net/bither/fragment/cold/AddAddressColdHDAccountFragment.java
bither-android/src/net/bither/fragment/cold/AddAddressColdHDAccountFragment.java
@@ -128,12 +128,6 @@ public class AddAddressColdHDAccountFragment extends Fragment implements AddHotA
try {
hdAccount = new HDAccountCold(MnemonicCode.instance(), new SecureRandom(), password);
final List<String> words = hdAccount.getSeedWords(password);
- String firstAddress = HDAccount.getFirstAddress(words);
- String dbFirstAddress = hdAccount.getFirstAddressFromDb();
- if (!firstAddress.equals(dbFirstAddress)) {
- onFailed(password);
- return;
- }
password.wipe();
BackupUtil.backupColdKey(false);
if (service != null) {
@@ -174,14 +168,7 @@ public class AddAddressColdHDAccountFragment extends Fragment implements AddHotA
};
void onFailed(SecureCharSequence password) {
- if (AddressManager.getInstance().noAddress()) {
- AbstractDb.addressProvider.deletePassword(password);
- }
password.wipe();
- if (hdAccount != null) {
- AbstractDb.hdAccountProvider.deleteHDAccount(hdAccount.getHdSeedId());
- AbstractDb.hdAccountAddressProvider.deleteHDAccountAddress(hdAccount.getHdSeedId());
- }
ThreadUtil.runOnMainThread(new Runnable() {
@Override
public void run() {

MODIFY
bither-android/src/net/bither/fragment/hot/AddAddressHotHDAccountFragment.java
bither-android/src/net/bither/fragment/hot/AddAddressHotHDAccountFragment.java
@@ -128,13 +128,6 @@ public class AddAddressHotHDAccountFragment extends Fragment implements AddHotAd
try {
hdAccount = new HDAccount(new SecureRandom(), password, null);
final List<String> words = hdAccount.getSeedWords(password);
- String firstAddress = HDAccount.getFirstAddress(words);
- String dbFirstAddress = hdAccount.getFirstAddressFromDb();
- if (!firstAddress.equals(dbFirstAddress)) {
- onFailed(password);
- return;
- }
-
password.wipe();
KeyUtil.setHDAccount(hdAccount);
if (service != null) {
@@ -175,14 +168,7 @@ public class AddAddressHotHDAccountFragment extends Fragment implements AddHotAd
};
void onFailed(SecureCharSequence password) {
- if (AddressManager.getInstance().noAddress()) {
- AbstractDb.addressProvider.deletePassword(password);
- }
password.wipe();
- if (hdAccount != null) {
- AbstractDb.hdAccountProvider.deleteHDAccount(hdAccount.getHdSeedId());
- AbstractDb.hdAccountAddressProvider.deleteHDAccountAddress(hdAccount.getHdSeedId());
- }
ThreadUtil.runOnMainThread(new Runnable() {
@Override
public void run() {

MODIFY
bither-android/src/net/bither/fragment/hot/OptionHotFragment.java
bither-android/src/net/bither/fragment/hot/OptionHotFragment.java
@@ -769,9 +769,7 @@ public class OptionHotFragment extends Fragment implements Selectable,
public void runWithService
(BlockchainService service) {
try {
- final HDAccount account = new
- HDAccount(key.getPubKeyExtended(),
- finalP2shp2wpkhKey == null ? null : finalP2shp2wpkhKey.getPubKeyExtended(),
+ final HDAccount account = new HDAccount(key.getPubKeyExtended(), finalP2shp2wpkhKey == null ? null : finalP2shp2wpkhKey.getPubKeyExtended(),
false, false, null);
if (service != null) {
service.stopAndUnregister();
@@ -805,6 +803,18 @@ public class OptionHotFragment extends Fragment implements Selectable,
.showDropdownMessage(getActivity(), R.string.monitor_cold_hd_account_failed_duplicated);
}
});
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ ThreadUtil.runOnMainThread(new Runnable() {
+ @Override
+ public void run() {
+ if (dp.isShowing()) {
+ dp.dismiss();
+ }
+ DropdownMessage
+ .showDropdownMessage(getActivity(), R.string.monitor_cold_hd_account_failed);
+ }
+ });
}
}
}.start();

MODIFY
bither-android/src/net/bither/xrandom/BitpieHDAccountColdUEntropyActivity.java
bither-android/src/net/bither/xrandom/BitpieHDAccountColdUEntropyActivity.java
@@ -147,19 +147,7 @@ public class BitpieHDAccountColdUEntropyActivity extends UEntropyActivity {
return;
}
- final List<String> validWords = hdAccount.getSeedWords(password);
- String firstAddress = HDAccount.getFirstAddress(words);
- String dbFirstAddress = hdAccount.getFirstAddressFromDb();
- if (!firstAddress.equals(dbFirstAddress)) {
- onFailed(hdSeedId, password, new Runnable() {
- @Override
- public void run() {
- finishGenerate(service);
- }
- });
- return;
- }
- words = validWords;
+ words = hdAccount.getSeedWords(password);
BackupUtil.backupColdKey(false);
@@ -171,18 +159,13 @@ public class BitpieHDAccountColdUEntropyActivity extends UEntropyActivity {
e.printStackTrace();
}
- if (success) {
finishGenerate(service);
+ if (success) {
while (System.currentTimeMillis() - startGeneratingTime < MinGeneratingTime) { }
onProgress(1);
onSuccess(BitpieHDAccountCold.BitpieHDAccountPlaceHolder);
} else {
- onFailed(hdSeedId, password, new Runnable() {
- @Override
- public void run() {
- finishGenerate(service);
- }
- });
+ onFailed();
}
}
}

MODIFY
bither-android/src/net/bither/xrandom/HDAccountColdUEntropyActivity.java
bither-android/src/net/bither/xrandom/HDAccountColdUEntropyActivity.java
@@ -141,22 +141,7 @@ public class HDAccountColdUEntropyActivity extends UEntropyActivity {
runOnUiThread(cancelRunnable);
return;
}
-
- final List<String> validWords = hdAccount.getSeedWords(password);
- String firstAddress = HDAccount.getFirstAddress(words);
- String dbFirstAddress = hdAccount.getFirstAddressFromDb();
- if (!firstAddress.equals(dbFirstAddress)) {
-
- onFailed(hdSeedId, password, new Runnable() {
- @Override
- public void run() {
- finishGenerate(service);
- }
- });
- return;
- }
-
- words = validWords;
+ words = hdAccount.getSeedWords(password);
BackupUtil.backupColdKey(false);
@@ -168,18 +153,13 @@ public class HDAccountColdUEntropyActivity extends UEntropyActivity {
e.printStackTrace();
}
- if (success) {
finishGenerate(service);
+ if (success) {
while (System.currentTimeMillis() - startGeneratingTime < MinGeneratingTime) { }
onProgress(1);
onSuccess(HDAccount.HDAccountPlaceHolder);
} else {
- onFailed(hdSeedId, password, new Runnable() {
- @Override
- public void run() {
- finishGenerate(service);
- }
- });
+ onFailed();
}
}
}

MODIFY
bither-android/src/net/bither/xrandom/HDAccountHotUEntropyActivity.java
bither-android/src/net/bither/xrandom/HDAccountHotUEntropyActivity.java
@@ -149,19 +149,7 @@ public class HDAccountHotUEntropyActivity extends UEntropyActivity {
return;
}
- final List<String> validWords = hdAccount.getSeedWords(password);
- String firstAddress = HDAccount.getFirstAddress(words);
- String dbFirstAddress = hdAccount.getFirstAddressFromDb();
- if (!firstAddress.equals(dbFirstAddress)) {
- onFailed(hdSeedId, password, new Runnable() {
- @Override
- public void run() {
- finishGenerate(service);
- }
- });
- return;
- }
- words = validWords;
+ words = hdAccount.getSeedWords(password);
KeyUtil.setHDAccount(hdAccount);
onProgress(1);
@@ -172,18 +160,13 @@ public class HDAccountHotUEntropyActivity extends UEntropyActivity {
e.printStackTrace();
}
- if (success) {
finishGenerate(service);
+ if (success) {
while (System.currentTimeMillis() - startGeneratingTime < MinGeneratingTime) { }
onProgress(1);
onSuccess(HDAccount.HDAccountPlaceHolder);
} else {
- onFailed(hdSeedId, password, new Runnable() {
- @Override
- public void run() {
- finishGenerate(service);
- }
- });
+ onFailed();
}
}
}

MODIFY
bither-android/src/net/bither/xrandom/UEntropyActivity.java
bither-android/src/net/bither/xrandom/UEntropyActivity.java
@@ -279,20 +279,6 @@ public abstract class UEntropyActivity extends BaseFragmentActivity implements U
});
}
- protected void onFailed(Integer hdSeedId, SecureCharSequence password, Runnable finishGenerateRunnable) {
- if (AddressManager.getInstance().noAddress()) {
- AbstractDb.addressProvider.deletePassword(password);
- }
- if (hdSeedId != null) {
- AbstractDb.hdAccountProvider.deleteHDAccount(hdSeedId);
- AbstractDb.hdAccountAddressProvider.deleteHDAccountAddress(hdSeedId);
- }
- if (finishGenerateRunnable != null) {
- finishGenerateRunnable.run();
- }
- onFailed();
- }
-
protected void onFailed() {
runOnUiThread(new Runnable() {
@Override

MODIFY
bitherj
bitherj
-Subproject commit 8391aa5b235da5e9556f7819598104eac4adc9c2
+Subproject commit b00cc1255a7f8291e8bf152ac8b3902e46118fc0

modify create or import HDAccount