2018-03-04 14:56:49 +01:00
|
|
|
package transaction
|
|
|
|
|
|
|
|
import (
|
2019-09-16 12:18:13 +03:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/io"
|
2018-03-04 14:56:49 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// MinerTX represents a miner transaction.
|
|
|
|
type MinerTX struct {
|
2018-03-25 12:45:54 +02:00
|
|
|
// Random number to avoid hash collision.
|
2018-03-04 14:56:49 +01:00
|
|
|
Nonce uint32
|
|
|
|
}
|
|
|
|
|
|
|
|
// DecodeBinary implements the Payload interface.
|
2019-09-16 12:18:13 +03:00
|
|
|
func (tx *MinerTX) DecodeBinary(r *io.BinReader) error {
|
|
|
|
r.ReadLE(&tx.Nonce)
|
|
|
|
return r.Err
|
2018-03-04 14:56:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// EncodeBinary implements the Payload interface.
|
2019-09-16 12:18:13 +03:00
|
|
|
func (tx *MinerTX) EncodeBinary(w *io.BinWriter) error {
|
|
|
|
w.WriteLE(tx.Nonce)
|
|
|
|
return w.Err
|
2018-03-04 14:56:49 +01:00
|
|
|
}
|
2019-08-30 11:28:30 +03:00
|
|
|
|
2019-09-03 17:51:37 +03:00
|
|
|
// Size returns serialized binary size for this transaction.
|
2019-08-30 11:28:30 +03:00
|
|
|
func (tx *MinerTX) Size() int {
|
|
|
|
return 4 // Nonce
|
|
|
|
}
|