2018-03-04 13:56:49 +00:00
|
|
|
package transaction
|
|
|
|
|
|
|
|
import (
|
2019-09-16 09:18:13 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/io"
|
2018-03-21 16:11:04 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/util"
|
2018-03-04 13:56:49 +00:00
|
|
|
)
|
|
|
|
|
2019-02-20 17:39:32 +00:00
|
|
|
// Input represents a Transaction input (CoinReference).
|
2018-03-04 13:56:49 +00:00
|
|
|
type Input struct {
|
|
|
|
// The hash of the previous transaction.
|
2019-02-20 17:39:32 +00:00
|
|
|
PrevHash util.Uint256 `json:"txid"`
|
2018-03-04 13:56:49 +00:00
|
|
|
|
|
|
|
// The index of the previous transaction.
|
2019-02-20 17:39:32 +00:00
|
|
|
PrevIndex uint16 `json:"vout"`
|
2018-03-04 13:56:49 +00:00
|
|
|
}
|
|
|
|
|
2019-09-16 16:31:49 +00:00
|
|
|
// DecodeBinary implements Serializable interface.
|
|
|
|
func (in *Input) DecodeBinary(br *io.BinReader) {
|
2019-08-28 16:27:06 +00:00
|
|
|
br.ReadLE(&in.PrevHash)
|
|
|
|
br.ReadLE(&in.PrevIndex)
|
2018-03-04 13:56:49 +00:00
|
|
|
}
|
|
|
|
|
2019-09-16 16:31:49 +00:00
|
|
|
// EncodeBinary implements Serializable interface.
|
|
|
|
func (in *Input) EncodeBinary(bw *io.BinWriter) {
|
2019-12-06 15:22:21 +00:00
|
|
|
bw.WriteBytes(in.PrevHash[:])
|
2019-08-28 16:27:06 +00:00
|
|
|
bw.WriteLE(in.PrevIndex)
|
2018-03-04 13:56:49 +00:00
|
|
|
}
|