bug fixes (TCP + uint256) and started core part (#14)

* Fixed TCP read + Uint256 reversed array + started on some core pieces

* Disabled some debug output + muted test

* 0.5.0
This commit is contained in:
Anthony De Meulemeester 2018-02-04 20:54:51 +01:00 committed by GitHub
parent 5aed624f1d
commit 628656483a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 824 additions and 337 deletions

24
pkg/util/uint160.go Normal file
View file

@ -0,0 +1,24 @@
package util
import (
"encoding/hex"
)
const uint160Size = 20
// Uint160 is a 20 byte long unsigned integer.
type Uint160 [uint160Size]uint8
// ToSlice returns a byte slice of u.
func (u Uint160) ToSlice() []byte {
b := make([]byte, uint160Size)
for i := 0; i < uint160Size; i++ {
b[i] = byte(u[i])
}
return b
}
// String implements the stringer interface.
func (u Uint160) String() string {
return hex.EncodeToString(u.ToSlice())
}