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
35
pkg/network/payload/headers.go
Normal file
35
pkg/network/payload/headers.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package payload
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/CityOfZion/neo-go/pkg/core"
|
||||
"github.com/CityOfZion/neo-go/pkg/util"
|
||||
)
|
||||
|
||||
// Headers payload
|
||||
type Headers struct {
|
||||
Hdrs []*core.Header
|
||||
}
|
||||
|
||||
// DecodeBinary implements the Payload interface.
|
||||
func (p *Headers) DecodeBinary(r io.Reader) error {
|
||||
lenHeaders := util.ReadVarUint(r)
|
||||
|
||||
p.Hdrs = make([]*core.Header, lenHeaders)
|
||||
|
||||
for i := 0; i < int(lenHeaders); i++ {
|
||||
header := &core.Header{}
|
||||
if err := header.DecodeBinary(r); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Hdrs[i] = header
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeBinary implements the Payload interface.
|
||||
func (h *Headers) EncodeBinary(w io.Writer) error {
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue