Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build的时候报错,好像是类型错误,这个怎么调整?谢谢 #1

Open
yujiye opened this issue Oct 12, 2018 · 2 comments

Comments

@yujiye
Copy link

yujiye commented Oct 12, 2018

我打开了main.go里面的

//2.测试创世区块
genesisBlock := BLC.CreateGenesisBlock("Genesis Block")
fmt.Println(genesisBlock)

这一部分
build的时候如下所示
E:/Go/bin/go.exe build -i [C:/Users/Alex/go/src/MyPublicChain]

MyPublicChain

.\main.go:15:41: cannot use "Genesis Block" (type string) as type []*BLC.Transaction in argument to BLC.CreateGenesisBlock

@DiaboFong
Copy link
Owner

Alex,你可以打开BLC.CreateGenesisBlock方法,后期的代码已经调整为如下内容,所以,不再支持String类型的形参

func CreateGenesisBlock(txs []*Transaction) *Block{

	return NewBlock(txs,make([]byte,32,32),0)
}

所以最终的代码中,这一段是被注释掉的,请悉知,我这个代码跟我写的一些文档是在项目做完之后的一个梳理,如果是逐步写的话,建议参考https://github.com/liuchengxu/blockchain-tutorial这篇文档,我也是根据这篇文章学习编码的。

@yujiye
Copy link
Author

yujiye commented Oct 16, 2018

非常感谢,我爱上了github。哈哈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants