diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/storage.go | 4 | ||||
-rw-r--r-- | core/verification.go | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/core/storage.go b/core/storage.go index 8346c12..6e9245a 100644 --- a/core/storage.go +++ b/core/storage.go @@ -27,6 +27,10 @@ type Node struct { PrevNodeSum string } +func (n *Node) GetHash() (string, error) { + return calculateStringHash(fmt.Sprintf("%d%d%s%s", n.BlockStart, n.BlockEnd, n.BlockSum, n.PrevNodeSum)) +} + func parseUnitSpec(size []byte) int { switch size[0] { case 0: diff --git a/core/verification.go b/core/verification.go index b48c0b7..7c427c0 100644 --- a/core/verification.go +++ b/core/verification.go @@ -11,6 +11,8 @@ import ( "github.com/tarm/serial" ) +var TotalReadBlocks int = 0 + func fileReadKey() (string, error) { if _, err := os.Stat(config.KeyLocation); os.IsNotExist(err) { return "", fmt.Errorf("Key location %s does not exist", config.KeyLocation) @@ -98,6 +100,7 @@ func ReadBlock(node Node, part *bufio.Reader) ([]byte, error) { return []byte{}, err } block, err = part.Peek(blockSize) + TotalReadBlocks = TotalReadBlocks + blockSize return block, err } |