2020-10-15 11:45:29 +00:00
|
|
|
package transaction
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Conflicts represents attribute for conflicting transactions.
|
|
|
|
type Conflicts struct {
|
|
|
|
Hash util.Uint256 `json:"hash"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// DecodeBinary implements io.Serializable interface.
|
|
|
|
func (c *Conflicts) DecodeBinary(br *io.BinReader) {
|
2020-11-18 11:00:24 +00:00
|
|
|
bytes := br.ReadVarBytes(util.Uint256Size)
|
|
|
|
if br.Err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
hash, err := util.Uint256DecodeBytesBE(bytes)
|
2020-10-15 11:45:29 +00:00
|
|
|
if err != nil {
|
|
|
|
br.Err = err
|
|
|
|
return
|
|
|
|
}
|
|
|
|
c.Hash = hash
|
|
|
|
}
|
|
|
|
|
|
|
|
// EncodeBinary implements io.Serializable interface.
|
|
|
|
func (c *Conflicts) EncodeBinary(w *io.BinWriter) {
|
|
|
|
w.WriteVarBytes(c.Hash.BytesBE())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Conflicts) toJSONMap(m map[string]interface{}) {
|
|
|
|
m["hash"] = c.Hash
|
|
|
|
}
|