Improved catching up and refactored

This commit is contained in:
obscuren
2014-09-15 15:42:12 +02:00
parent 2f614900e8
commit 33a0dec8a1
11 changed files with 129 additions and 106 deletions

View File

@@ -9,6 +9,22 @@ import (
"strings"
)
type Bytes []byte
func (self Bytes) String() string {
return string(self)
}
func DeleteFromByteSlice(s [][]byte, hash []byte) [][]byte {
for i, h := range s {
if bytes.Compare(h, hash) == 0 {
return append(s[:i], s[i+1:]...)
}
}
return s
}
// Number to bytes
//
// Returns the number in bytes with the specified base