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:
parent
5aed624f1d
commit
628656483a
27 changed files with 824 additions and 337 deletions
24
pkg/util/uint160.go
Normal file
24
pkg/util/uint160.go
Normal 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())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue