2019-11-08 15:40:21 +00:00
|
|
|
package consensus
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/CityOfZion/neo-go/pkg/core/transaction"
|
|
|
|
"github.com/CityOfZion/neo-go/pkg/io"
|
|
|
|
"github.com/CityOfZion/neo-go/pkg/util"
|
|
|
|
)
|
|
|
|
|
|
|
|
// prepareRequest represents dBFT PrepareRequest message.
|
|
|
|
type prepareRequest struct {
|
|
|
|
Timestamp uint32
|
|
|
|
Nonce uint64
|
|
|
|
TransactionHashes []util.Uint256
|
|
|
|
MinerTransaction transaction.Transaction
|
|
|
|
NextConsensus util.Uint160
|
|
|
|
}
|
|
|
|
|
|
|
|
// EncodeBinary implements io.Serializable interface.
|
|
|
|
func (p *prepareRequest) EncodeBinary(w *io.BinWriter) {
|
|
|
|
w.WriteLE(p.Timestamp)
|
|
|
|
w.WriteLE(p.Nonce)
|
|
|
|
w.WriteBE(p.NextConsensus[:])
|
2019-11-14 08:07:23 +00:00
|
|
|
w.WriteArray(p.TransactionHashes)
|
2019-11-08 15:40:21 +00:00
|
|
|
p.MinerTransaction.EncodeBinary(w)
|
|
|
|
}
|
|
|
|
|
|
|
|
// DecodeBinary implements io.Serializable interface.
|
|
|
|
func (p *prepareRequest) DecodeBinary(r *io.BinReader) {
|
|
|
|
r.ReadLE(&p.Timestamp)
|
|
|
|
r.ReadLE(&p.Nonce)
|
|
|
|
r.ReadBE(p.NextConsensus[:])
|
2019-11-14 08:07:23 +00:00
|
|
|
r.ReadArray(&p.TransactionHashes)
|
2019-11-08 15:40:21 +00:00
|
|
|
p.MinerTransaction.DecodeBinary(r)
|
|
|
|
}
|