2019-02-25 22:44:14 +00:00
|
|
|
package transaction
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/CityOfZion/neo-go/pkg/wire/payload/transaction/types"
|
|
|
|
"github.com/CityOfZion/neo-go/pkg/wire/payload/transaction/version"
|
|
|
|
"github.com/CityOfZion/neo-go/pkg/wire/util"
|
|
|
|
)
|
|
|
|
|
2019-03-17 18:26:35 +00:00
|
|
|
//Miner represents a miner transaction on the neo network
|
2019-02-25 22:44:14 +00:00
|
|
|
type Miner struct {
|
|
|
|
*Base
|
|
|
|
Nonce uint32
|
|
|
|
}
|
|
|
|
|
2019-03-17 18:26:35 +00:00
|
|
|
//NewMiner returns a miner transaction
|
2019-02-25 22:44:14 +00:00
|
|
|
func NewMiner(ver version.TX) *Miner {
|
|
|
|
basicTrans := createBaseTransaction(types.Miner, ver)
|
|
|
|
|
|
|
|
Miner := &Miner{}
|
|
|
|
Miner.Base = basicTrans
|
|
|
|
Miner.encodeExclusive = Miner.encodeExcl
|
|
|
|
Miner.decodeExclusive = Miner.decodeExcl
|
|
|
|
return Miner
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Miner) encodeExcl(bw *util.BinWriter) {
|
|
|
|
bw.Write(c.Nonce)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Miner) decodeExcl(br *util.BinReader) {
|
|
|
|
br.Read(&c.Nonce)
|
|
|
|
}
|