4 "github.com/bytom/crypto/sha3pool"
5 "github.com/bytom/protocol/bc"
8 type IssuanceInput struct {
12 // Note: as long as we require serflags=0x7, we don't need to
13 // explicitly store the asset ID here even though it's technically
14 // part of the input commitment. We can compute it instead from
15 // values in the witness (which, with serflags other than 0x7,
16 // might not be present).
22 func (ii *IssuanceInput) IsIssuance() bool { return true }
23 func (ii *IssuanceInput) IsCoinbase() bool { return false }
25 func (ii *IssuanceInput) AssetID() bc.AssetID {
26 defhash := ii.AssetDefinitionHash()
27 return bc.ComputeAssetID(ii.IssuanceProgram, &ii.InitialBlock, ii.VMVersion, &defhash)
30 func (ii *IssuanceInput) AssetDefinitionHash() (defhash bc.Hash) {
31 sha := sha3pool.Get256()
32 defer sha3pool.Put256(sha)
33 sha.Write(ii.AssetDefinition)
38 func NewIssuanceInput(
43 issuanceProgram []byte,
45 assetDefinition []byte,
49 ReferenceData: referenceData,
50 TypedInput: &IssuanceInput{
53 IssuanceWitness: IssuanceWitness{
54 InitialBlock: initialBlock,
55 AssetDefinition: assetDefinition,
57 IssuanceProgram: issuanceProgram,