neoneo-go/pkg/core/transaction/miner.go
Roman Khimov 54d888ba70 io: add type-specific read/write methods
This seriously improves the serialization/deserialization performance for
several reasons:
 * no time spent in `binary` reflection
 * no memory allocations being made on every read/write
 * uses fast ReadBytes everywhere it's appropriate

It also makes Fixed8 Serializable just for convenience.
2019-12-12 20:19:50 +03:00

21 lines
456 B
Go

package transaction
import (
"github.com/CityOfZion/neo-go/pkg/io"
)
// MinerTX represents a miner transaction.
type MinerTX struct {
// Random number to avoid hash collision.
Nonce uint32
}
// DecodeBinary implements Serializable interface.
func (tx *MinerTX) DecodeBinary(r *io.BinReader) {
tx.Nonce = r.ReadU32LE()
}
// EncodeBinary implements Serializable interface.
func (tx *MinerTX) EncodeBinary(w *io.BinWriter) {
w.WriteU32LE(tx.Nonce)
}