Beispiel #1
0
func mustMakeUtxoOutput(addr string, amount uint64, hours uint64) coin.TransactionOutput {
	uo := coin.TransactionOutput{}
	uo.Address = cipher.MustDecodeBase58Address(addr)
	uo.Coins = amount
	uo.Hours = hours
	return uo
}
Beispiel #2
0
func TransactionOutputFromJSON(in TransactionOutputJSON) (coin.TransactionOutput, error) {
	var tx coin.TransactionOutput

	//hash, err := cipher.SHA256FromHex(in.Hash)
	//if err != nil {
	//	return coin.TransactionOutput{}, errors.New("Invalid hash")
	//}
	addr, err := cipher.DecodeBase58Address(in.Address)
	if err != nil {
		return coin.TransactionOutput{}, errors.New("Adress decode fail")
	}
	//tx.Hash = hash
	tx.Address = addr
	tx.Coins = in.Coins
	tx.Hours = in.Hours

	return tx, nil
}