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

第三章的AddBlock #21

Open
zjfsdnu opened this issue Nov 11, 2019 · 0 comments
Open

第三章的AddBlock #21

zjfsdnu opened this issue Nov 11, 2019 · 0 comments

Comments

@zjfsdnu
Copy link

zjfsdnu commented Nov 11, 2019

开头从数据库取最后一个块的hash是多余的 因为tip已经指向了
`
var lastHash []byte

// 首先获取最后一个块的哈希用于生成新块的哈希
err := bc.db.View(func(tx *bolt.Tx) error {
	b := tx.Bucket([]byte(blocksBucket))
	lastHash = b.Get([]byte("l"))

	return nil
})

if err != nil {
	log.Panic(err)
}

`

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

1 participant