|
@@ -31,6 +31,10 @@ const BACKUPPUBKEYINDEX = "backuppubkeyindex"
|
|
// PubKey
|
|
// PubKey
|
|
var PubKey string = ""
|
|
var PubKey string = ""
|
|
|
|
|
|
|
|
+//bitcoin PubKey Child index
|
|
|
|
+var StartCount uint32 = 0
|
|
|
|
+var EndCount uint32 = 0
|
|
|
|
+
|
|
|
|
|
|
func (m BitCoin) InitDriver(parm interface{}) bool {
|
|
func (m BitCoin) InitDriver(parm interface{}) bool {
|
|
if m.initconfig() == false {
|
|
if m.initconfig() == false {
|
|
@@ -244,13 +248,26 @@ func (m BitCoin) CreateAddressFromHdWallet() ([]byte, error) {
|
|
if len(string(backuppubkeyindex)) == 0 {
|
|
if len(string(backuppubkeyindex)) == 0 {
|
|
backupindex = 0
|
|
backupindex = 0
|
|
} else {
|
|
} else {
|
|
- fmt.Println("litedb.Get BACKUPPUBKEYINDEX:", string(backuppubkeyindex))
|
|
|
|
|
|
|
|
if err := json.Unmarshal([]byte(backuppubkeyindex), &backupindex); err != nil {
|
|
if err := json.Unmarshal([]byte(backuppubkeyindex), &backupindex); err != nil {
|
|
fmt.Println("Unmarshal err :", err.Error())
|
|
fmt.Println("Unmarshal err :", err.Error())
|
|
return nil, fmt.Errorf(`{"errcode":%v,"mesage":"%s"}`, INNER_ERR, getErrMsg(INNER_ERR, nil))
|
|
return nil, fmt.Errorf(`{"errcode":%v,"mesage":"%s"}`, INNER_ERR, getErrMsg(INNER_ERR, nil))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ LOG("DEBUG", "litedb.Get BACKUPPUBKEYINDEX:%v", backupindex)
|
|
|
|
+
|
|
|
|
+ //check pubkey child start index
|
|
|
|
+ if backupindex < StartCount {
|
|
|
|
+ LOG("ERROR", " backupindex:%v < StartCount:%v!", backupindex, StartCount)
|
|
|
|
+ backupindex = StartCount
|
|
|
|
+ }
|
|
|
|
+ //check pubkey child end index
|
|
|
|
+ if EndCount != 0 && backupindex > EndCount {
|
|
|
|
+ LOG("ERROR", " backupindex:%v > EndCount:%v!", backupindex, EndCount)
|
|
|
|
+ return nil, fmt.Errorf(`{"errcode":%v,"mesage":"%s"}`, INNER_ERR, getErrMsg(INNER_ERR, nil))
|
|
|
|
+ }
|
|
|
|
+
|
|
index := backupindex + 1
|
|
index := backupindex + 1
|
|
|
|
|
|
pubkey := btc.StringChild(PubKey, index)
|
|
pubkey := btc.StringChild(PubKey, index)
|
|
@@ -368,6 +385,10 @@ func (m BitCoin) initconfig() bool {
|
|
PubKey = Config.Pubkey.Pubkeystr
|
|
PubKey = Config.Pubkey.Pubkeystr
|
|
LOG("DEBUG", "PubKey:%v", PubKey)
|
|
LOG("DEBUG", "PubKey:%v", PubKey)
|
|
|
|
|
|
|
|
+ StartCount = Config.Count.Startcount
|
|
|
|
+ EndCount = Config.Count.Endcount
|
|
|
|
+ LOG("DEBUG", "StartCount:%v,EndCount%v", StartCount, EndCount)
|
|
|
|
+
|
|
f, err := strconv.ParseFloat(Config.Limit.Fee, 64)
|
|
f, err := strconv.ParseFloat(Config.Limit.Fee, 64)
|
|
if err != nil {
|
|
if err != nil {
|
|
LOG("ERROR", "inner json error:%v", err.Error())
|
|
LOG("ERROR", "inner json error:%v", err.Error())
|