INNER CODE UNIT · Go
TestBlockSignBlockWriteReadVerifyBlock
volodymyrprokopyuk/go-blockchain · chain/block_test.go:11
func TestBlockSignBlockWriteReadVerifyBlock(t *testing.T) {
defer os.RemoveAll(keyStoreDir)
defer os.RemoveAll(blockStoreDir)
// Create and persist the genesis
gen, err := createGenesis()
if err != nil {
t.Fatal(err)
}
// Re-create the authority account from the genesis
path := filepath.Join(keyStoreDir, string(gen.Authority))
auth, err := chain.ReadAccount(path, []byte(authPass))
if err != nil {
t.Fatal(err)
}
// Re-create the initial owner account from the genesis
ownerAcc, _ := genesisAccount(gen)
path = filepath.Join(keyStoreDir, string(ownerAcc))
acc, err := chain.ReadAccount(path, []byte(ownerPass))