本文整理汇总了Golang中github.com/c-darwin/dcoin-go/packages/utils.BytesToInt64函数的典型用法代码示例。如果您正苦于以下问题:Golang BytesToInt64函数的具体用法?Golang BytesToInt64怎么用?Golang BytesToInt64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BytesToInt64函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:35,代码来源:new_max_other_currencies.go
示例2: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:35,代码来源:change_arbitration_days_refund.go
示例3: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:35,代码来源:abuses.go
示例4: NewUserFront
func (p *Parser) NewUserFront() error {
log.Debug("NewUserFront")
err := p.generalCheck()
if err != nil {
return p.ErrInfo(err)
}
// является ли данный юзер майнером
err = p.checkMiner(p.TxUserID)
if err != nil {
return p.ErrInfo(err)
}
// прошло ли 30 дней с момента регистрации майнера
err = p.checkMinerNewbie()
if err != nil {
return p.ErrInfo(err)
}
// чтобы не записали слишком мелкий или слишком крупный ключ
if !utils.CheckInputData(p.TxMap["public_key_hex"], "public_key") {
return utils.ErrInfo(fmt.Errorf("incorrect public_key %s", p.TxMap["public_key_hex"]))
}
// публичный ключ должен быть без паролей
if ok, _ := regexp.MatchString("DEK-Info: (.+),(.+)", string(p.TxMap["public_key"])); ok {
return p.ErrInfo("incorrect public_key")
}
forSign := fmt.Sprintf("%s,%s,%s,%s", p.TxMap["type"], p.TxMap["time"], p.TxMap["user_id"], p.TxMap["public_key_hex"])
CheckSignResult, err := utils.CheckSign(p.PublicKeys, forSign, p.TxMap["sign"], false)
if err != nil {
return p.ErrInfo(err)
}
if !CheckSignResult {
return p.ErrInfo("incorrect sign")
}
// один ключ не может быть у двух юзеров
num, err := p.DCDB.Single("SELECT count(user_id) FROM users WHERE hex(public_key_0) = ? OR hex(public_key_1) = ? OR hex(public_key_2) = ?",
p.TxMap["public_key_hex"], p.TxMap["public_key_hex"], p.TxMap["public_key_hex"]).Int()
if num > 0 {
return p.ErrInfo("exists public_key")
}
err = p.getAdminUserId()
if err != nil {
return p.ErrInfo(err)
}
if utils.BytesToInt64(p.TxMap["user_id"]) == p.AdminUserId {
err = p.limitRequest(1000, "new_user", 86400)
} else {
err = p.limitRequest(p.Variables.Int64["limit_new_user"], "new_user", p.Variables.Int64["limit_new_user_period"])
}
if err != nil {
return p.ErrInfo(err)
}
return nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:60,代码来源:new_user.go
示例5: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:34,代码来源:new_user.go
示例6: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:57,代码来源:new_miner.go
示例7: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:55,代码来源:cf_project_data.go
示例8: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:54,代码来源:votes_complex.go
示例9: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:54,代码来源:mining.go
示例10: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:49,代码来源:send_dc.go
示例11: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:47,代码来源:new_cf_project.go
示例12: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:43,代码来源:test_new_promised_amount..go
示例13: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:43,代码来源:new_forex_order.go
示例14: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:42,代码来源:money_back_request.go
示例15: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:42,代码来源:mining_front.go
示例16: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:41,代码来源:admin_spots.go
示例17: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:41,代码来源:cf_send_dc.go
示例18: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:39,代码来源:change_geolocation.go
示例19: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:39,代码来源:change_primary_key.go
示例20: main
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)
}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:39,代码来源:new_seller.go
注:本文中的github.com/c-darwin/dcoin-go/packages/utils.BytesToInt64函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论