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