-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from nspcc-dev/untie-neogo
*: get rid of github.com/nspcc-dev/neo-go/pkg/io dependency
- Loading branch information
Showing
15 changed files
with
392 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ import ( | |
"testing" | ||
|
||
"github.com/nspcc-dev/neo-go/pkg/util" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,53 @@ | ||
package payload | ||
|
||
import "github.com/nspcc-dev/neo-go/pkg/io" | ||
import ( | ||
"encoding/gob" | ||
) | ||
|
||
type ( | ||
changeViewCompact struct { | ||
validatorIndex uint16 | ||
originalViewNumber byte | ||
timestamp uint32 | ||
ValidatorIndex uint16 | ||
OriginalViewNumber byte | ||
Timestamp uint32 | ||
} | ||
|
||
commitCompact struct { | ||
viewNumber byte | ||
validatorIndex uint16 | ||
signature [signatureSize]byte | ||
ViewNumber byte | ||
ValidatorIndex uint16 | ||
Signature [signatureSize]byte | ||
} | ||
|
||
preparationCompact struct { | ||
validatorIndex uint16 | ||
ValidatorIndex uint16 | ||
} | ||
) | ||
|
||
// EncodeBinary implements io.Serializable interface. | ||
func (p changeViewCompact) EncodeBinary(w *io.BinWriter) { | ||
w.WriteU16LE(p.validatorIndex) | ||
w.WriteB(p.originalViewNumber) | ||
w.WriteU32LE(p.timestamp) | ||
// EncodeBinary implements Serializable interface. | ||
func (p changeViewCompact) EncodeBinary(w *gob.Encoder) error { | ||
return w.Encode(p) | ||
} | ||
|
||
// DecodeBinary implements io.Serializable interface. | ||
func (p *changeViewCompact) DecodeBinary(r *io.BinReader) { | ||
p.validatorIndex = r.ReadU16LE() | ||
p.originalViewNumber = r.ReadB() | ||
p.timestamp = r.ReadU32LE() | ||
// DecodeBinary implements Serializable interface. | ||
func (p *changeViewCompact) DecodeBinary(r *gob.Decoder) error { | ||
return r.Decode(p) | ||
} | ||
|
||
// EncodeBinary implements io.Serializable interface. | ||
func (p commitCompact) EncodeBinary(w *io.BinWriter) { | ||
w.WriteB(p.viewNumber) | ||
w.WriteU16LE(p.validatorIndex) | ||
w.WriteBytes(p.signature[:]) | ||
// EncodeBinary implements Serializable interface. | ||
func (p commitCompact) EncodeBinary(w *gob.Encoder) error { | ||
return w.Encode(p) | ||
} | ||
|
||
// DecodeBinary implements io.Serializable interface. | ||
func (p *commitCompact) DecodeBinary(r *io.BinReader) { | ||
p.viewNumber = r.ReadB() | ||
p.validatorIndex = r.ReadU16LE() | ||
r.ReadBytes(p.signature[:]) | ||
// DecodeBinary implements Serializable interface. | ||
func (p *commitCompact) DecodeBinary(r *gob.Decoder) error { | ||
return r.Decode(p) | ||
} | ||
|
||
// EncodeBinary implements io.Serializable interface. | ||
func (p preparationCompact) EncodeBinary(w *io.BinWriter) { | ||
w.WriteU16LE(p.validatorIndex) | ||
// EncodeBinary implements Serializable interface. | ||
func (p preparationCompact) EncodeBinary(w *gob.Encoder) error { | ||
return w.Encode(p) | ||
} | ||
|
||
// DecodeBinary implements io.Serializable interface. | ||
func (p *preparationCompact) DecodeBinary(r *io.BinReader) { | ||
p.validatorIndex = r.ReadU16LE() | ||
// DecodeBinary implements Serializable interface. | ||
func (p *preparationCompact) DecodeBinary(r *gob.Decoder) error { | ||
return r.Decode(p) | ||
} |
Oops, something went wrong.