func MakeFEREntryWithHeightFromContent(passedResidentHeight uint32, passedTargetActivationHeight uint32, passedTargetPrice uint64, passedExpirationHeight uint32, passedPriority uint32) *FEREntryWithHeight { // Create and format the signing private key var signingPrivateKey [64]byte SigningPrivateKey := "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" signingBytes, err := hex.DecodeString(SigningPrivateKey) if err != nil { fmt.Println("Signing private key isn't parsable") return nil } copy(signingPrivateKey[:], signingBytes[:]) _ = ed.GetPublicKey(&signingPrivateKey) // Needed to format the public half of the key set anFEREntry := new(specialEntries.FEREntry) anFEREntry.SetExpirationHeight(passedExpirationHeight) anFEREntry.SetTargetActivationHeight(passedTargetActivationHeight) anFEREntry.SetPriority(passedPriority) anFEREntry.SetTargetPrice(passedTargetPrice) entryJson, err := json.Marshal(anFEREntry) if err != nil { fmt.Println("Bad marshal of anFEREntry") return nil } // Create the factom entry with the signing private key signingSignature := ed.Sign(&signingPrivateKey, entryJson) // Make a new factom entry and populate it anEntry := new(factom.Entry) anEntry.ChainID = "111111118d918a8be684e0dac725493a75862ef96d2d3f43f84b26969329bf03" anEntry.ExtIDs = append(anEntry.ExtIDs, signingSignature[:]) anEntry.Content = entryJson // ce := common.NewEntry() emb, _ := anEntry.MarshalBinary() // ce.UnmarshalBinary(emb) EBEntry := entryBlock.NewEntry() _, err = EBEntry.UnmarshalBinaryData(emb) if err != nil { fmt.Println("Error 3: couldn't unmarshal binary") return nil } ewh := new(FEREntryWithHeight) // Don't set the resident height in the actual FEREntry yet because the state validate loop will handle all that ewh.Height = passedResidentHeight ewh.AnFEREntry = EBEntry return ewh }
flag.Parse() args = flag.Args() if len(args) < 1 { fmt.Println(cmd.helpMsg) return } ecpub := args[0] e := new(factom.Entry) if *cid == "" { fmt.Println(cmd.helpMsg) return } e.ChainID = *cid //for _, id := range eids { // e.ExtIDs = append(e.ExtIDs, []byte(id)) //} e.ExtIDs = exidCollector // Entry.Content is read from stdin if p, err := ioutil.ReadAll(os.Stdin); err != nil { errorln(err) return } else if size := len(p); size > 10240 { errorln("Entry of %d bytes is too large", size) return } else { e.Content = p