Example #1
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "DelPromisedAmount"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	// promised_amount_id
	txSlice = append(txSlice, []byte("4"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #2
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "ChangeKeyActive"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("91573"))
	// secret
	txSlice = append(txSlice, []byte("156516546572676276827"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "ChangeArbitrationDaysRefund"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("91573"))
	// arbitration_days_refund
	txSlice = append(txSlice, []byte("150"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #4
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "Abuses"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	// message
	txSlice = append(txSlice, []byte(`{"1":"fdfdsfdd", "2":"fsdfkj43 43 34"}`))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #5
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "NewPct"
	txTime := "1599278817"
	userId := []byte("2")
	var blockId int64 = 140015
	//data:=`{"currency":{"1":{"miner_pct":"0.0000000617044","user_pct":"0.0000000439591"},"72":{"miner_pct":"0.0000000617044","user_pct":"0.0000000439591"}},"referral":{"first":10,"second":0,"third":0}}`
	data := `{"currency":{"1":{"miner_pct":"0.0000000617044","user_pct":"0.0000000435602"},"72":{"miner_pct":"0.0000000760368","user_pct":"0.0000000562834"}},"referral":{"first":30,"second":20,"third":5}}`

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// promised_amount_id
	txSlice = append(txSlice, []byte(data))

	dataForSign := fmt.Sprintf("%v,%v,%s,%s", utils.TypeInt(txType), txTime, userId, data)

	err := tests_utils.MakeFrontTest(txSlice, utils.StrToInt64(txTime), dataForSign, txType, utils.BytesToInt64(userId), "", blockId)
	if err != nil {
		fmt.Println(err)
	}

}
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "NewMaxOtherCurrencies"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	// json data
	txSlice = append(txSlice, []byte(`{"1":"1000", "72":500}`))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #7
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "NewUser"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	// public_key
	txSlice = append(txSlice, utils.HexToBin([]byte("30820122300d06092a864886f70d01010105000382010f003082010a0282010100ae7797b5c16358862f083bb26cde86b233ba97c48087df44eaaf88efccfe554bf51df8dc7e99072cbe433933f1b87aa9ef62bd5d49dc40e75fe398426c727b0773ea9e4d88184d64c1aa561b1cdf78abe07ca5d23711c403f58abf30d41f4b96161649a91a95818d9d482e8fa3f91829abce3d80f6fc3708ce23f6841bb4a8bae301b23745fce5134420fec0519a081f162d16e4dd0da2e8869b5b67122a1fb7e9bcdb8b2512d1edabdb271bee190563b36a66f5498f50d2fc7202ad2f43b90f860428d5ecd67973900d9997475d4e1a1e4c56b44411cc4b5e9c660fe23fdcd5ab956a834fa05a4ecac9d815143d84993c9424d86379b6f76e3be9aeaaff48fb0203010001)")))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))
	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #8
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "ChangeHost"
	txTime := "1399278817"
	userId := []byte("2")
	var blockId int64 = 1415
	host := "http://fdfdfd.ru/"

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// promised_amount_id
	txSlice = append(txSlice, []byte(host))

	dataForSign := fmt.Sprintf("%v,%v,%s,%s", utils.TypeInt(txType), txTime, userId, host)

	err := tests_utils.MakeFrontTest(txSlice, utils.StrToInt64(txTime), dataForSign, txType, utils.BytesToInt64(userId), "", blockId)
	if err != nil {
		fmt.Println(err)
	}
}
Example #9
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "NewMiner."
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("91573"))
	//race
	txSlice = append(txSlice, []byte("1"))
	//country
	txSlice = append(txSlice, []byte("1"))
	//latitude
	txSlice = append(txSlice, []byte("55"))
	//longitude
	txSlice = append(txSlice, []byte("55"))
	//host
	txSlice = append(txSlice, []byte("http://55.55.55.55/"))
	//face_coords
	txSlice = append(txSlice, []byte("[[118,275],[241,274],[39,274],[316,276],[180,364],[182,430],[181,490],[93,441],[259,433]]"))
	//profile_coords
	txSlice = append(txSlice, []byte("[[289,224],[148,216],[172,304],[123,239],[328,261],[305,349]]"))
	//face_hash
	txSlice = append(txSlice, []byte("face_hash"))
	//profile_hash
	txSlice = append(txSlice, []byte("profile_hash"))
	//video_type
	txSlice = append(txSlice, []byte("youtube"))
	//video_url_id
	txSlice = append(txSlice, []byte("video_url_id"))
	//node_public_key
	txSlice = append(txSlice, []byte("node_public_key"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #10
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "CfProjectData"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("4"))
	//project_id
	txSlice = append(txSlice, []byte("1"))
	//lang_id
	txSlice = append(txSlice, []byte("45"))
	//blurb_img
	txSlice = append(txSlice, []byte("http://i.imgur.com/YRCoVnc.jpg"))
	//head_img
	txSlice = append(txSlice, []byte("http://i.imgur.com/YRCoVnc.jpg"))
	//description_img
	txSlice = append(txSlice, []byte("http://i.imgur.com/YRCoVnc.jpg"))
	//picture
	txSlice = append(txSlice, []byte("http://i.imgur.com/YRCoVnc.jpg"))
	//video_type
	txSlice = append(txSlice, []byte("youtube"))
	//video_url_id
	txSlice = append(txSlice, []byte("X-_fg47G5yf-_f"))
	//news_img
	txSlice = append(txSlice, []byte("http://i.imgur.com/YRCoVnc.jpg"))
	//links
	txSlice = append(txSlice, []byte(`[["http:\/\/goo.gl\/fnfh1Dg",1,532,234,0],["http:\/\/goo.gl\/28Fh4h",1355,1344,2222,66]]`))
	//hide
	txSlice = append(txSlice, []byte("1"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #11
0
func main() {

	f, err := os.OpenFile("dclog.txt", os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0777)
	defer f.Close()
	//log.SetOutput(f)
	log.SetOutput(io.MultiWriter(f, os.Stdout))
	log.SetFlags(log.LstdFlags | log.Lshortfile)

	txType := "Mining"
	txTime := "1406545931"
	userId := []byte("2")
	var blockId int64 = 123924

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// promised_amount_id
	txSlice = append(txSlice, []byte(`26`))
	// amount
	txSlice = append(txSlice, []byte(`6`))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	dir, err := utils.GetCurrentDir()
	if err != nil {
		fmt.Println(err)
	}
	configIni_, err := config.NewConfig("ini", dir+"/config.ini")
	if err != nil {
		fmt.Println(err)
	}
	configIni, err := configIni_.GetSection("default")
	db := utils.DbConnect(configIni)

	// делаем снимок БД в виде хэшей до начала тестов
	hashesStart, err := tests_utils.AllHashes(db)

	err = tests_utils.MakeTest(txSlice, blockData, txType, hashesStart, db, "work")
	if err != nil {
		fmt.Println(err)
	}

}
Example #12
0
func main() {
	/*	Currency map[string][]float64 `json:"currency"`
		Referral map[string]int64 `json:"referral"`
		Admin int64 `json:"admin"`
	*/
	f := tests_utils.InitLog()
	defer f.Close()

	txType := "VotesComplex"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008
	newPct := new(vComplex)
	newPct.Currency = make(map[string][]float64)
	newPct.Referral = make(map[string]int64)
	newPct.Currency["1"] = []float64{0.0000000760368, 0.0000000497405, 1000, 55, 10}
	newPct.Currency["33"] = []float64{0.0000000760368, 0.0000000497405, 1000, 55, 10}
	newPct.Currency["2"] = []float64{0.0000000760368, 0.0000000497405, 1000, 55, 10}
	newPct.Referral["first"] = 30
	newPct.Referral["second"] = 0
	newPct.Referral["third"] = 30
	newPct.Admin = 100
	newPctJson, _ := json.Marshal(newPct)

	//newPct1:=new(vComplex)
	//err := json.Unmarshal([]byte(`{"currency":{"1":[7.60368e-08,4.97405e-08,1000,55,10],"2":[7.60368e-08,4.97405e-08,1000,55,10],"33":[7.60368e-08,4.97405e-08,1000,55,10]},"referral":{"first":30,"second":0,"third":30},"admin":100}`), &newPct1)
	//fmt.Println(newPct1)
	//fmt.Println(err)

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// newPctJson
	txSlice = append(txSlice, []byte(newPctJson))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #13
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "SendDc"
	txTime := "1409288580"
	userId := []byte("2")
	var blockId int64 = 10000

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// to_user_id
	txSlice = append(txSlice, []byte("2"))
	// currency_id
	txSlice = append(txSlice, []byte("72"))
	// amount
	txSlice = append(txSlice, []byte("8"))
	// commission
	txSlice = append(txSlice, []byte("0.1"))
	/*	for i:=0; i<5; i++ {
			txSlice = append(txSlice, []byte("0"))
		}
		for i:=0; i<5; i++ {
			txSlice = append(txSlice, []byte("0"))
		}*/
	// comment
	txSlice = append(txSlice, []byte("1111111111111111111111111111111111"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #14
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "NewCfProject"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("4"))
	//currency_id
	txSlice = append(txSlice, []byte("72"))
	//amount
	txSlice = append(txSlice, []byte("5000"))
	//end_time
	txSlice = append(txSlice, []byte("1427383713"))
	//latitude
	txSlice = append(txSlice, []byte("39.94801"))
	//langitude
	txSlice = append(txSlice, []byte("39.94801"))
	//category
	txSlice = append(txSlice, []byte("1"))
	//project_currency_name
	txSlice = append(txSlice, []byte("0VVDDDF"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "NewPromisedAmount."
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	// currency_id
	txSlice = append(txSlice, []byte("72"))
	// amount
	txSlice = append(txSlice, []byte("1000"))
	// video_type
	txSlice = append(txSlice, []byte("youtube"))
	// video_url_id
	txSlice = append(txSlice, []byte("fdfdfd"))
	// payment_systems_ids
	txSlice = append(txSlice, []byte("11,55,88"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #16
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "NewForexOrder"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// sell_currency_id
	txSlice = append(txSlice, []byte("1"))
	// sell_rate
	txSlice = append(txSlice, []byte("0.1"))
	// amount
	txSlice = append(txSlice, []byte("1"))
	// buy_currency_id
	txSlice = append(txSlice, []byte("72"))
	// commission
	txSlice = append(txSlice, []byte("0"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #17
0
func main() {

	f, err := os.OpenFile("dclog.txt", os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0777)
	defer f.Close()
	//log.SetOutput(f)
	log.SetOutput(io.MultiWriter(f, os.Stdout))
	log.SetFlags(log.LstdFlags | log.Lshortfile)

	txType := "Mining"
	txTime := "1406545938"
	userId := []byte("105")
	var blockId int64 = 123925
	promised_amount_id := "24"
	amount := "5.69"

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// promised_amount_id
	txSlice = append(txSlice, []byte(promised_amount_id))
	// amount
	txSlice = append(txSlice, []byte(amount))

	dataForSign := fmt.Sprintf("%v,%v,%s,%s,%s", utils.TypeInt(txType), txTime, userId, promised_amount_id, amount)

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err = tests_utils.MakeFrontTest(txSlice, utils.StrToInt64(txTime), dataForSign, txType, utils.BytesToInt64(userId), "", blockId)
	if err != nil {
		fmt.Println(err)
	}

}
Example #18
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "MoneyBackRequest"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("91573"))
	// order_id
	txSlice = append(txSlice, []byte("1"))
	// arbitrator_enc_text
	for i := 0; i < 5; i++ {
		txSlice = append(txSlice, []byte("2222222222222222"))
	}

	// seller_enc_text
	txSlice = append(txSlice, []byte("3333333333333333"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #19
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "AdminSpots"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	// example_spots
	txSlice = append(txSlice, []byte("example_spots"))
	// segments
	txSlice = append(txSlice, []byte("segments"))
	// tolerances
	txSlice = append(txSlice, []byte("tolerances"))
	// compatibility
	txSlice = append(txSlice, []byte("compatibility"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #20
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "CfSendDc"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	//project_id
	txSlice = append(txSlice, []byte("11"))
	//amount
	txSlice = append(txSlice, []byte("100"))
	//commission
	txSlice = append(txSlice, []byte("5"))
	//comment
	txSlice = append(txSlice, []byte(`ORDER #15155 а"))в"))ы"))А"))в"))ы"))А"))ы"))в"))а"))в"))ы"))`))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #21
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "AdminNewVersion"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	// soft_type
	txSlice = append(txSlice, []byte("php"))
	// version
	txSlice = append(txSlice, []byte("0.0.99a"))
	// file
	txSlice = append(txSlice, []byte("file"))
	// format
	txSlice = append(txSlice, []byte("zip"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #22
0
func (c *Controller) SendToTheChat() (string, error) {

	c.r.ParseForm()
	message := c.r.FormValue("message")
	decryptMessage := c.r.FormValue("decrypt_message")
	sender := utils.StrToInt64(c.r.FormValue("sender"))
	receiver := utils.StrToInt64(c.r.FormValue("receiver"))
	lang := utils.StrToInt64(c.r.FormValue("lang"))
	room := utils.StrToInt64(c.r.FormValue("room"))
	// chatEncrypted == 1
	status := utils.StrToInt64(c.r.FormValue("status"))
	signTime := utils.StrToInt64(c.r.FormValue("sign_time"))
	signature := []byte(c.r.FormValue("signature"))

	data := utils.Int64ToByte(lang)
	data = append(data, utils.Int64ToByte(room)...)
	data = append(data, utils.Int64ToByte(receiver)...)
	data = append(data, utils.Int64ToByte(sender)...)
	data = append(data, utils.Int64ToByte(status)...)
	data = append(data, []byte(message)...)
	data = append(data, utils.Int64ToByte(signTime)...)
	data = append(data, []byte(signature)...)

	hash := utils.Md5(data)

	err := c.CheckChatMessage(message, sender, receiver, lang, room, status, signTime, signature)
	if err != nil {
		return "", utils.ErrInfo(err)
	}

	var chatId int64
	// на пуле сообщение сразу отобразится у всех
	if status == 1 {
		chatId, err = c.ExecSqlGetLastInsertId(`INSERT INTO chat (hash, time, lang, room, receiver, sender, status, enc_message, message, sign_time, signature) VALUES ([hex], ?, ?, ?, ?, ?, ?, ?, ?, ?, [hex])`, "id", hash, utils.Time(), lang, room, receiver, sender, 2, message, decryptMessage, signTime, signature)

	} else {
		chatId, err = c.ExecSqlGetLastInsertId(`INSERT INTO chat (hash, time, lang, room, receiver, sender, status, message, sign_time, signature) VALUES ([hex], ?, ?, ?, ?, ?, ?, ?, ?, [hex])`, "id", hash, utils.Time(), lang, room, receiver, sender, status, message, signTime, signature)
	}
	if err != nil {
		return "", utils.ErrInfo(err)
	}

	// даем команду рассыльщику, чтобы отправил всем хэш тр-ии сообщения
	utils.ChatNewTx <- chatId

	return utils.JsonAnswer("success", "success").String(), nil
}
Example #23
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "ChangePrimaryKey"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008
	var bin_public_key_pack []byte
	bin_public_key_pack = append(bin_public_key_pack, utils.EncodeLengthPlusData(utils.HexToBin([]byte("111111111")))...)
	bin_public_key_pack = append(bin_public_key_pack, utils.EncodeLengthPlusData(utils.HexToBin(([]byte(""))))...)
	bin_public_key_pack = append(bin_public_key_pack, utils.EncodeLengthPlusData(utils.HexToBin([]byte("")))...)

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	// public_keys
	txSlice = append(txSlice, []byte(bin_public_key_pack))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #24
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "VotesComplex"
	txTime := "1499278817"
	userId := []byte("2")
	var blockId int64 = 128008
	newPct := new(vComplex)
	newPct.Currency = make(map[string][]float64)
	newPct.Referral = make(map[string]string)
	newPct.Currency["1"] = []float64{0.0000000760368, 0.0000000497405, 1000, 55, 10}
	newPct.Currency["72"] = []float64{0.0000000760368, 0.0000000497405, 1000, 55, 10}
	newPct.Referral["first"] = "30"
	newPct.Referral["second"] = "0"
	newPct.Referral["third"] = "30"
	newPct.Admin = 100
	newPctJson, _ := json.Marshal(newPct)

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// newPctJson
	txSlice = append(txSlice, []byte(newPctJson))

	dataForSign := fmt.Sprintf("%v,%v,%s,%s", utils.TypeInt(txType), txTime, userId, newPctJson)

	err := tests_utils.MakeFrontTest(txSlice, utils.StrToInt64(txTime), dataForSign, txType, utils.BytesToInt64(userId), "", blockId)
	if err != nil {
		fmt.Println(err)
	}
}
Example #25
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "NewSeller"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("91573"))
	//arbitration_trust_list \[[0-9]{1,10}(,[0-9]{1,10}){0,100}\]
	txSlice = append(txSlice, []byte("[1,2,3,6,4,91573]"))
	//arbitration_days_refund
	txSlice = append(txSlice, []byte("30"))
	//holdback_pct_array \[\"[0-9]{1,3}(\.[0-9]{2})?\"(,\"[0-9]{1,3}(\.[0-9]{2}\")?){3}\]
	txSlice = append(txSlice, []byte(`["100.00", "90.55", "0.00"]`))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #26
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "CfComment"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	//project_id
	txSlice = append(txSlice, []byte("1"))
	//lang_id
	txSlice = append(txSlice, []byte("1"))
	//comment
	txSlice = append(txSlice, []byte(`К"))о"))м"))м"))е"))н"))т)) http://google.com/ 54fds56f4sd`))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #27
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "ChangeGeolocation"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("91573"))
	// latitude
	txSlice = append(txSlice, []byte("55.66998"))
	// longitude
	txSlice = append(txSlice, []byte("11.66998"))
	// country
	txSlice = append(txSlice, []byte("12"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
Example #28
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "AdminChangePrimaryKey"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("91573"))
	// for_user_id
	txSlice = append(txSlice, []byte("91573"))
	// public_key
	txSlice = append(txSlice, []byte("ParseData::encode_length_plus_data(hextobin(423423423))"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
func MaxOtherCurrenciesGenerator(chBreaker chan bool, chAnswer chan string) {
	defer func() {
		if r := recover(); r != nil {
			log.Error("daemon Recovered", r)
			panic(r)
		}
	}()

	const GoroutineName = "MaxOtherCurrenciesGenerator"
	d := new(daemon)
	d.DCDB = DbConnect(chBreaker, chAnswer, GoroutineName)
	if d.DCDB == nil {
		return
	}
	d.goRoutineName = GoroutineName
	d.chAnswer = chAnswer
	d.chBreaker = chBreaker
	if utils.Mobile() {
		d.sleepTime = 3600
	} else {
		d.sleepTime = 60
	}
	if !d.CheckInstall(chBreaker, chAnswer, GoroutineName) {
		return
	}
	d.DCDB = DbConnect(chBreaker, chAnswer, GoroutineName)
	if d.DCDB == nil {
		return
	}

	err = d.notMinerSetSleepTime(1800)
	if err != nil {
		log.Error("%v", err)
		return
	}

BEGIN:
	for {
		log.Info(GoroutineName)
		MonitorDaemonCh <- []string{GoroutineName, utils.Int64ToStr(utils.Time())}

		// проверим, не нужно ли нам выйти из цикла
		if CheckDaemonsRestart(chBreaker, chAnswer, GoroutineName) {
			break BEGIN
		}

		err, restart := d.dbLock()
		if restart {
			break BEGIN
		}
		if err != nil {
			if d.dPrintSleep(err, d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}

		blockId, err := d.GetBlockId()
		if err != nil {
			if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}
		if blockId == 0 {
			if d.unlockPrintSleep(utils.ErrInfo("blockId == 0"), d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}

		_, _, myMinerId, _, _, _, err := d.TestBlock()
		if err != nil {
			if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}
		// а майнер ли я ?
		if myMinerId == 0 {
			if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}
		variables, err := d.GetAllVariables()
		curTime := utils.Time()

		totalCountCurrencies, err := d.GetCountCurrencies()
		if err != nil {
			if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}
		// проверим, прошло ли 2 недели с момента последнего обновления
		pctTime, err := d.Single("SELECT max(time) FROM max_other_currencies_time").Int64()
		if err != nil {
			if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}
		if curTime-pctTime <= variables.Int64["new_max_other_currencies"] {
			if d.unlockPrintSleep(utils.ErrInfo("14 day error"), d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}

		// берем все голоса
		maxOtherCurrenciesVotes := make(map[int64][]map[int64]int64)
		rows, err := d.Query("SELECT currency_id, count, count(user_id) as votes FROM votes_max_other_currencies GROUP BY currency_id, count ORDER BY currency_id, count ASC")
		if err != nil {
			if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}
		for rows.Next() {
			var currency_id, count, votes int64
			err = rows.Scan(&currency_id, &count, &votes)
			if err != nil {
				rows.Close()
				if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
					break BEGIN
				}
				continue BEGIN
			}
			maxOtherCurrenciesVotes[currency_id] = append(maxOtherCurrenciesVotes[currency_id], map[int64]int64{count: votes})
		}
		rows.Close()

		newMaxOtherCurrenciesVotes := make(map[string]int64)
		for currencyId, countAndVotes := range maxOtherCurrenciesVotes {
			newMaxOtherCurrenciesVotes[utils.Int64ToStr(currencyId)] = utils.GetMaxVote(countAndVotes, 0, totalCountCurrencies, 10)
		}

		jsonData, err := json.Marshal(newMaxOtherCurrenciesVotes)

		_, myUserId, _, _, _, _, err := d.TestBlock()
		forSign := fmt.Sprintf("%v,%v,%v,%s", utils.TypeInt("NewMaxOtherCurrencies"), curTime, myUserId, jsonData)
		log.Debug("forSign = %v", forSign)
		binSign, err := d.GetBinSign(forSign, myUserId)
		if err != nil {
			if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}
		data := utils.DecToBin(utils.TypeInt("NewMaxOtherCurrencies"), 1)
		data = append(data, utils.DecToBin(curTime, 4)...)
		data = append(data, utils.EncodeLengthPlusData(utils.Int64ToByte(myUserId))...)
		data = append(data, utils.EncodeLengthPlusData(jsonData)...)
		data = append(data, utils.EncodeLengthPlusData([]byte(binSign))...)

		err = d.InsertReplaceTxInQueue(data)
		if err != nil {
			if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}

		p := new(dcparser.Parser)
		p.DCDB = d.DCDB
		err = p.TxParser(utils.HexToBin(utils.Md5(data)), data, true)
		if err != nil {
			if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}

		d.dbUnlock()

		if d.dSleep(d.sleepTime) {
			break BEGIN
		}
	}
	log.Debug("break BEGIN %v", GoroutineName)
}
Example #30
0
func NodeVoting(chBreaker chan bool, chAnswer chan string) {
	defer func() {
		if r := recover(); r != nil {
			log.Error("daemon Recovered", r)
			panic(r)
		}
	}()

	const GoroutineName = "NodeVoting"
	d := new(daemon)
	d.DCDB = DbConnect(chBreaker, chAnswer, GoroutineName)
	if d.DCDB == nil {
		return
	}
	d.goRoutineName = GoroutineName
	d.chAnswer = chAnswer
	d.chBreaker = chBreaker
	if utils.Mobile() {
		d.sleepTime = 3600
	} else {
		d.sleepTime = 60
	}
	if !d.CheckInstall(chBreaker, chAnswer, GoroutineName) {
		return
	}
	d.DCDB = DbConnect(chBreaker, chAnswer, GoroutineName)
	if d.DCDB == nil {
		return
	}

	err = d.notMinerSetSleepTime(1800)
	if err != nil {
		log.Error("%v", err)
		return
	}

BEGIN:
	for {
		log.Info(GoroutineName)
		MonitorDaemonCh <- []string{GoroutineName, utils.Int64ToStr(utils.Time())}

		// проверим, не нужно ли нам выйти из цикла
		if CheckDaemonsRestart(chBreaker, chAnswer, GoroutineName) {
			break BEGIN
		}

		err, restart := d.dbLock()
		if restart {
			break BEGIN
		}
		if err != nil {
			if d.dPrintSleep(err, d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}

		// берем данные, которые находятся на голосовании нодов
		rows, err := d.Query(d.FormatQuery(`
				SELECT miners_data.user_id,
							 http_host as host,
							 face_hash,
							 profile_hash,
							 photo_block_id,
							 photo_max_miner_id,
							 miners_keepers,
							 id as vote_id,
							 miner_id
				FROM votes_miners
				LEFT JOIN miners_data
						 ON votes_miners.user_id = miners_data.user_id
				WHERE cron_checked_time < ? AND
							 votes_end = 0 AND
							 type = 'node_voting'
				`), utils.Time()-consts.CRON_CHECKED_TIME_SEC)
		if err != nil {
			if d.dPrintSleep(utils.ErrInfo(err), d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}
		if ok := rows.Next(); ok {
			var vote_id, miner_id int64
			var user_id, host, row_face_hash, row_profile_hash, photo_block_id, photo_max_miner_id, miners_keepers string
			err = rows.Scan(&user_id, &host, &row_face_hash, &row_profile_hash, &photo_block_id, &photo_max_miner_id, &miners_keepers, &vote_id, &miner_id)
			if err != nil {
				rows.Close()
				if d.dPrintSleep(utils.ErrInfo(err), d.sleepTime) {
					break BEGIN
				}
				continue BEGIN
			}

			// проверим, не нужно нам выйти, т.к. обновилась версия софта
			if CheckDaemonsRestart(chBreaker, chAnswer, GoroutineName) {
				rows.Close()
				utils.Sleep(1)
				break
			}
			minersIds := utils.GetMinersKeepers(photo_block_id, photo_max_miner_id, miners_keepers, true)
			myUsersIds, err := d.GetMyUsersIds(true, true)
			myMinersIds, err := d.GetMyMinersIds(myUsersIds)

			// нет ли нас среди тех, кто должен скачать фото к себе и проголосовать
			var intersectMyMiners []int64
			for _, id := range minersIds {
				if utils.InSliceInt64(int64(id), myMinersIds) {
					intersectMyMiners = append(intersectMyMiners, int64(id))
				}
			}
			var vote int64
			if len(intersectMyMiners) > 0 {
				var downloadError bool
				var faceHash, profileHash string
				var faceFile, profileFile []byte
				// копируем фото  к себе
				profilePath := *utils.Dir + "/public/profile_" + user_id + ".jpg"
				_, err = utils.DownloadToFile(host+"/public/"+user_id+"_user_profile.jpg", profilePath, 60, chBreaker, chAnswer, GoroutineName)
				if err != nil {
					log.Error("%s", utils.ErrInfo(err))
					downloadError = true
				}
				facePath := *utils.Dir + "/public/face_" + user_id + ".jpg"
				_, err = utils.DownloadToFile(host+"/public/"+user_id+"_user_face.jpg", facePath, 60, chBreaker, chAnswer, GoroutineName)
				if err != nil {
					log.Error("%s", utils.ErrInfo(err))
					downloadError = true
				}
				if !downloadError {
					// хэши скопированных фото
					profileFile, err = ioutil.ReadFile(profilePath)
					if err != nil {
						rows.Close()
						if d.dPrintSleep(utils.ErrInfo(err), d.sleepTime) {
							break BEGIN
						}
						continue BEGIN
					}
					profileHash = string(utils.DSha256(profileFile))
					log.Info("%v", "profileHash", profileHash)
					faceFile, err = ioutil.ReadFile(facePath)
					if err != nil {
						rows.Close()
						if d.dPrintSleep(utils.ErrInfo(err), d.sleepTime) {
							break BEGIN
						}
						continue BEGIN
					}
					faceHash = string(utils.DSha256(faceFile))
					log.Info("%v", "faceHash", faceHash)
				}
				// проверяем хэш. Если сходится, то голосуем за, если нет - против и размер не должен быть более 200 Kb.
				if profileHash == row_profile_hash && faceHash == row_face_hash && len(profileFile) < 204800 && len(faceFile) < 204800 {
					vote = 1
				} else {
					log.Error("%s %s %s %s %d %d", profileHash, row_face_hash, faceHash, row_profile_hash, len(profileFile), len(faceFile))
					vote = 0 // если хэш не сходится, то удаляем только что скаченное фото
					os.Remove(profilePath)
					os.Remove(facePath)
				}

				// проходимся по всем нашим майнерам, если это пул и по одному, если это сингл-мод
				for _, myMinerId := range intersectMyMiners {

					myUserId, err := d.Single("SELECT user_id FROM miners_data WHERE miner_id  =  ?", myMinerId).Int64()
					if err != nil {
						rows.Close()
						if d.dPrintSleep(utils.ErrInfo(err), d.sleepTime) {
							break BEGIN
						}
						continue BEGIN
					}

					curTime := utils.Time()

					forSign := fmt.Sprintf("%v,%v,%v,%v,%v", utils.TypeInt("VotesNodeNewMiner"), curTime, myUserId, vote_id, vote)
					binSign, err := d.GetBinSign(forSign, myUserId)
					if err != nil {
						rows.Close()
						if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
							break BEGIN
						}
						continue BEGIN
					}
					data := utils.DecToBin(utils.TypeInt("VotesNodeNewMiner"), 1)
					data = append(data, utils.DecToBin(curTime, 4)...)
					data = append(data, utils.EncodeLengthPlusData(utils.Int64ToByte(myUserId))...)
					data = append(data, utils.EncodeLengthPlusData(utils.Int64ToByte(vote_id))...)
					data = append(data, utils.EncodeLengthPlusData(utils.Int64ToByte(vote))...)
					data = append(data, utils.EncodeLengthPlusData([]byte(binSign))...)

					err = d.InsertReplaceTxInQueue(data)
					if err != nil {
						rows.Close()
						if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
							break BEGIN
						}
						continue BEGIN
					}

				}
			}

			// отмечаем, чтобы больше не брать эту строку
			err = d.ExecSql("UPDATE votes_miners SET cron_checked_time = ? WHERE id = ?", utils.Time(), vote_id)
			if err != nil {
				rows.Close()
				if d.unlockPrintSleep(utils.ErrInfo(err), d.sleepTime) {
					break BEGIN
				}
				continue BEGIN
			}
		}
		rows.Close()
		d.dbUnlock()

		if d.dSleep(d.sleepTime) {
			break BEGIN
		}
	}
	log.Debug("break BEGIN %v", GoroutineName)

}