modfiy dynamic fee
MODIFY
bither-android/src/net/bither/SendActivity.java
bither-android/src/net/bither/SendActivity.java
@@ -69,6 +69,7 @@ import net.bither.ui.base.keyboard.amount.AmountEntryKeyboardView;
import net.bither.ui.base.keyboard.password.PasswordEntryKeyboardView;
import net.bither.ui.base.listener.IBackClickListener;
import net.bither.util.BroadcastUtil;
+import net.bither.util.DynamicFeeUtils;
import net.bither.util.InputParser.StringInputParser;
import net.bither.util.MarketUtil;
import net.bither.util.ThreadUtil;
@@ -351,7 +352,12 @@ public class SendActivity extends SwipeRightActivity implements EntryKeyboardVie
ex.printStackTrace();
}
- final Long finalDynamicFeeBase = dynamicFeeBase;
+ final Long finalDynamicFeeBase;
+ if (address != null && !address.hasPrivKey()) {
+ finalDynamicFeeBase = DynamicFeeUtils.getFinalDynamicFeeBase(dynamicFeeBase);
+ } else {
+ finalDynamicFeeBase = dynamicFeeBase;
+ }
ThreadUtil.runOnMainThread(new Runnable() {
@Override
public void run() {

MODIFY
bither-android/src/net/bither/activity/hot/GenerateUnsignedTxActivity.java
bither-android/src/net/bither/activity/hot/GenerateUnsignedTxActivity.java
@@ -69,6 +69,7 @@ import net.bither.ui.base.keyboard.EntryKeyboardView;
import net.bither.ui.base.keyboard.amount.AmountEntryKeyboardView;
import net.bither.ui.base.listener.IBackClickListener;
import net.bither.util.BroadcastUtil;
+import net.bither.util.DynamicFeeUtils;
import net.bither.util.InputParser.StringInputParser;
import net.bither.util.MarketUtil;
import net.bither.util.ThreadUtil;
@@ -347,7 +348,7 @@ public class GenerateUnsignedTxActivity extends SwipeRightActivity implements En
} catch (Exception ex) {
ex.printStackTrace();
}
- final Long finalDynamicFeeBase = dynamicFeeBase;
+ final Long finalDynamicFeeBase = DynamicFeeUtils.getFinalDynamicFeeBase(dynamicFeeBase);
ThreadUtil.runOnMainThread(new Runnable() {
@Override
public void run() {

ADD
bither-android/src/net/bither/util/DynamicFeeUtils.java
+package net.bither.util;
+
+import net.bither.bitherj.utils.Base58;
+import net.bither.bitherj.utils.Utils;
+
+public class DynamicFeeUtils {
+
+ public static Long getFinalDynamicFeeBase(Long dynamicFeeBase) {
+ if (dynamicFeeBase == null || dynamicFeeBase <= 0) {
+ return dynamicFeeBase;
+ }
+ String dynamicFeeBaseHex = Long.toHexString(dynamicFeeBase);
+ if (Utils.isEmpty(dynamicFeeBaseHex)) {
+ return null;
+ }
+ boolean isAddress = false;
+ if (dynamicFeeBaseHex.length() % 2 == 0) {
+ try {
+ String address = Base58.hexToBase58WithAddress(dynamicFeeBaseHex);
+ isAddress = Utils.validBicoinAddress(address);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ if (!isAddress) {
+ return dynamicFeeBase;
+ }
+ try {
+ byte[] bytes = Utils.hexStringToByteArray(dynamicFeeBaseHex);
+ int first = bytes[0] + 1;
+ byte[] newBytes = new byte[bytes.length];
+ newBytes[0] = (byte) first;
+ Long dynamicFee = Long.parseLong(Utils.bytesToHexString(newBytes), 16);
+ return dynamicFee;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ return null;
+ }
+ }
+
+}

modfiy dynamic fee