OSDN Git Service

remove InitialBlockHash in Asset (#431)
authorYongfeng LI <wliyongfeng@gmail.com>
Fri, 16 Mar 2018 05:58:31 +0000 (13:58 +0800)
committerPaladz <yzhu101@uottawa.ca>
Fri, 16 Mar 2018 05:58:31 +0000 (13:58 +0800)
* remove InitialBlockHash in Asset

* remove InitialBlockId of AssetDefinition

19 files changed:
blockchain/asset/asset.go
blockchain/asset/builder.go
blockchain/txbuilder/txbuilder_test.go
protocol/bc/asset.go
protocol/bc/asset_test.go
protocol/bc/bc.pb.go
protocol/bc/bc.proto
protocol/bc/bctest/tx.go
protocol/bc/legacy/fuzz_test.go
protocol/bc/legacy/issuance.go
protocol/bc/legacy/issuance_witness.go
protocol/bc/legacy/map.go
protocol/bc/legacy/transaction_test.go
protocol/bc/legacy/tx_test.go
protocol/bc/legacy/txinput.go
protocol/bc/merkle_test.go
protocol/tx_test.go
protocol/validation/validation_test.go
protocol/validation/vmcontext_test.go

index 31abf50..6a04391 100755 (executable)
@@ -12,7 +12,6 @@ import (
        "golang.org/x/crypto/sha3"
 
        "github.com/bytom/blockchain/signers"
-       cfg "github.com/bytom/config"
        "github.com/bytom/consensus"
        "github.com/bytom/crypto/ed25519"
        "github.com/bytom/crypto/ed25519/chainkd"
@@ -36,7 +35,6 @@ const (
 )
 
 func initNativeAsset() {
-       genesisBlock := cfg.GenerateGenesisBlock()
        signer := &signers.Signer{Type: "internal"}
        alias := consensus.BTMAlias
 
@@ -48,7 +46,6 @@ func initNativeAsset() {
                VMVersion:         1,
                DefinitionMap:     consensus.BTMDefinitionMap,
                RawDefinitionByte: definitionBytes,
-               InitialBlockHash:  genesisBlock.Hash(),
        }
 }
 
@@ -118,7 +115,6 @@ type Asset struct {
        Alias             *string                `json:"alias"`
        VMVersion         uint64                 `json:"vm_version"`
        IssuanceProgram   chainjson.HexBytes     `json:"issue_program"`
-       InitialBlockHash  bc.Hash                `json:"init_blockhash"`
        Tags              map[string]interface{} `json:"tags"`
        RawDefinitionByte chainjson.HexBytes     `json:"raw_definition_byte"`
        DefinitionMap     map[string]interface{} `json:"definition"`
@@ -180,8 +176,7 @@ func (reg *Registry) Define(xpubs []chainkd.XPub, quorum int, definition map[str
                RawDefinitionByte: rawDefinition,
                VMVersion:         vmver,
                IssuanceProgram:   issuanceProgram,
-               InitialBlockHash:  reg.initialBlockHash,
-               AssetID:           bc.ComputeAssetID(issuanceProgram, &reg.initialBlockHash, vmver, &defHash),
+               AssetID:           bc.ComputeAssetID(issuanceProgram, vmver, &defHash),
                Signer:            assetSigner,
                Tags:              tags,
        }
index e09cd3c..6a6c447 100755 (executable)
@@ -52,7 +52,7 @@ func (a *issueAction) Build(ctx context.Context, builder *txbuilder.TemplateBuil
 
        assetDef := asset.RawDefinitionByte
 
-       txin := legacy.NewIssuanceInput(nonce[:], a.Amount, asset.InitialBlockHash, asset.IssuanceProgram, nil, assetDef)
+       txin := legacy.NewIssuanceInput(nonce[:], a.Amount, asset.IssuanceProgram, nil, assetDef)
 
        tplIn := &txbuilder.SigningInstruction{}
        path := signers.Path(asset.Signer, signers.AssetKeySpace)
index 678bf7b..b11ca65 100755 (executable)
@@ -85,7 +85,6 @@ func TestBuild(t *testing.T) {
 }
 
 func TestSignatureWitnessMaterialize(t *testing.T) {
-       var initialBlockHash bc.Hash
        privkey1, pubkey1, err := chainkd.NewXKeys(nil)
        if err != nil {
                t.Fatal(err)
@@ -99,12 +98,12 @@ func TestSignatureWitnessMaterialize(t *testing.T) {
                t.Fatal(err)
        }
        issuanceProg, _ := vmutil.P2SPMultiSigProgram([]ed25519.PublicKey{pubkey1.PublicKey(), pubkey2.PublicKey(), pubkey3.PublicKey()}, 2)
-       assetID := bc.ComputeAssetID(issuanceProg, &initialBlockHash, 1, &bc.EmptyStringHash)
+       assetID := bc.ComputeAssetID(issuanceProg, 1, &bc.EmptyStringHash)
        outscript := mustDecodeHex("76a914c5d128911c28776f56baaac550963f7b88501dc388c0")
        unsigned := legacy.NewTx(legacy.TxData{
                Version: 1,
                Inputs: []*legacy.TxInput{
-                       legacy.NewIssuanceInput([]byte{1}, 100, initialBlockHash, issuanceProg, nil, nil),
+                       legacy.NewIssuanceInput([]byte{1}, 100, issuanceProg, nil, nil),
                },
                Outputs: []*legacy.TxOutput{
                        legacy.NewTxOutput(assetID, 100, outscript),
index 4791a49..c95b169 100644 (file)
@@ -35,9 +35,8 @@ func (ad *AssetDefinition) ComputeAssetID() (assetID AssetID) {
        return NewAssetID(b)
 }
 
-func ComputeAssetID(prog []byte, initialBlockID *Hash, vmVersion uint64, data *Hash) AssetID {
+func ComputeAssetID(prog []byte, vmVersion uint64, data *Hash) AssetID {
        def := &AssetDefinition{
-               InitialBlockId: initialBlockID,
                IssuanceProgram: &Program{
                        VmVersion: vmVersion,
                        Code:      prog,
index 77566a0..54b6390 100644 (file)
@@ -8,10 +8,9 @@ import (
 
 func TestComputeAssetID(t *testing.T) {
        issuanceScript := []byte{1}
-       initialBlockHash := mustDecodeHash("dd506f5d4c3f904d3d4b3c3be597c9198c6193ffd14a28570e4a923ce40cf9e5")
-       assetID := ComputeAssetID(issuanceScript, &initialBlockHash, 1, &EmptyStringHash)
+       assetID := ComputeAssetID(issuanceScript, 1, &EmptyStringHash)
 
-       unhashed := append([]byte{}, initialBlockHash.Bytes()...)
+       unhashed := append([]byte{})
        unhashed = append(unhashed, []byte{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}...) // vmVersion
        unhashed = append(unhashed, 0x01)                                                      // length of issuanceScript
        unhashed = append(unhashed, issuanceScript...)
@@ -27,12 +26,11 @@ var assetIDSink AssetID
 
 func BenchmarkComputeAssetID(b *testing.B) {
        var (
-               initialBlockHash Hash
                issuanceScript   = []byte{5}
        )
 
        for i := 0; i < b.N; i++ {
-               assetIDSink = ComputeAssetID(issuanceScript, &initialBlockHash, 1, &EmptyStringHash)
+               assetIDSink = ComputeAssetID(issuanceScript, 1, &EmptyStringHash)
        }
 }
 
index ecdabfe..a135ee9 100644 (file)
@@ -177,9 +177,8 @@ func (m *AssetAmount) GetAmount() uint64 {
 }
 
 type AssetDefinition struct {
-       InitialBlockId  *Hash    `protobuf:"bytes,1,opt,name=initial_block_id,json=initialBlockId" json:"initial_block_id,omitempty"`
-       IssuanceProgram *Program `protobuf:"bytes,2,opt,name=issuance_program,json=issuanceProgram" json:"issuance_program,omitempty"`
-       Data            *Hash    `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
+       IssuanceProgram *Program `protobuf:"bytes,1,opt,name=issuance_program,json=issuanceProgram" json:"issuance_program,omitempty"`
+       Data            *Hash    `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
 }
 
 func (m *AssetDefinition) Reset()                    { *m = AssetDefinition{} }
@@ -187,13 +186,6 @@ func (m *AssetDefinition) String() string            { return proto.CompactTextS
 func (*AssetDefinition) ProtoMessage()               {}
 func (*AssetDefinition) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
 
-func (m *AssetDefinition) GetInitialBlockId() *Hash {
-       if m != nil {
-               return m.InitialBlockId
-       }
-       return nil
-}
-
 func (m *AssetDefinition) GetIssuanceProgram() *Program {
        if m != nil {
                return m.IssuanceProgram
@@ -751,66 +743,65 @@ func init() {
 func init() { proto.RegisterFile("bc.proto", fileDescriptor0) }
 
 var fileDescriptor0 = []byte{
-       // 961 bytes of a gzipped FileDescriptorProto
-       0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0xdb, 0x46,
-       0x10, 0x86, 0x44, 0x4a, 0xa4, 0xc7, 0xa9, 0x25, 0xad, 0x9d, 0x94, 0x08, 0x52, 0xc0, 0x60, 0xe1,
-       0x3a, 0x45, 0x00, 0xc3, 0xb1, 0xd3, 0xa2, 0x87, 0x1e, 0xea, 0xd6, 0x6d, 0xa3, 0x83, 0xdb, 0x60,
-       0x1d, 0xe4, 0x4a, 0xac, 0xc8, 0x8d, 0xb5, 0xa8, 0xc4, 0x55, 0x77, 0x97, 0xaa, 0xeb, 0xe7, 0xe8,
-       0xad, 0xf7, 0x3c, 0x44, 0x1f, 0xab, 0xe7, 0x1e, 0x8a, 0x1d, 0x2e, 0x25, 0xea, 0xc7, 0x89, 0x84,
-       0xa2, 0x37, 0xce, 0x0f, 0xe7, 0x9b, 0xf9, 0x66, 0x66, 0x77, 0x21, 0x1c, 0xa4, 0x27, 0x13, 0x25,
-       0x8d, 0x24, 0xcd, 0x41, 0x1a, 0xff, 0x00, 0xfe, 0x4b, 0xa6, 0x87, 0x64, 0x0f, 0x9a, 0xd3, 0xd3,
-       0xa8, 0x71, 0xd8, 0x78, 0xda, 0xa6, 0xcd, 0xe9, 0x29, 0xca, 0xcf, 0xa3, 0xa6, 0x93, 0x9f, 0xa3,
-       0x7c, 0x16, 0x79, 0x4e, 0x3e, 0x43, 0xf9, 0x3c, 0xf2, 0x9d, 0x7c, 0x1e, 0x7f, 0x0d, 0xc1, 0x2b,
-       0x25, 0x6f, 0x14, 0x1b, 0x93, 0x4f, 0x00, 0xa6, 0xe3, 0x64, 0xca, 0x95, 0x16, 0x32, 0xc7, 0x90,
-       0x3e, 0xdd, 0x99, 0x8e, 0xdf, 0x94, 0x0a, 0x42, 0xc0, 0x4f, 0x65, 0xc6, 0x31, 0xf6, 0x03, 0x8a,
-       0xdf, 0x71, 0x1f, 0x82, 0x0b, 0xad, 0xb9, 0xe9, 0x5f, 0xfe, 0xe7, 0x44, 0xae, 0x60, 0x17, 0x43,
-       0x5d, 0x8c, 0x65, 0x91, 0x1b, 0xf2, 0x19, 0x84, 0xcc, 0x8a, 0x89, 0xc8, 0x30, 0xe8, 0xee, 0xd9,
-       0xee, 0xc9, 0x20, 0x3d, 0x71, 0x68, 0x34, 0x40, 0x63, 0x3f, 0x23, 0x8f, 0xa0, 0xcd, 0xf0, 0x0f,
-       0x84, 0xf2, 0xa9, 0x93, 0xe2, 0x3f, 0x1b, 0xd0, 0x41, 0xe7, 0x4b, 0xfe, 0x56, 0xe4, 0xc2, 0xd8,
-       0x0a, 0xce, 0xa0, 0x8b, 0x9f, 0x6c, 0x94, 0x0c, 0x46, 0x32, 0xfd, 0x65, 0x1e, 0x3b, 0xb4, 0xb1,
-       0x2d, 0x9f, 0x74, 0xcf, 0x79, 0x7c, 0x6b, 0x1d, 0xfa, 0x19, 0xf9, 0x12, 0xba, 0x42, 0xeb, 0x82,
-       0xe5, 0x29, 0x4f, 0x26, 0x25, 0x51, 0x88, 0xe4, 0xf2, 0x71, 0xdc, 0xd1, 0x4e, 0xe5, 0x54, 0x91,
-       0xf9, 0x04, 0xfc, 0x8c, 0x19, 0x86, 0x05, 0xd7, 0xe3, 0xa3, 0x36, 0x1e, 0xc1, 0xee, 0x1b, 0x36,
-       0x2a, 0xf8, 0xb5, 0x2c, 0x54, 0xca, 0xc9, 0x63, 0xf0, 0x14, 0x7f, 0xbb, 0x92, 0x8b, 0x55, 0x92,
-       0x23, 0x68, 0x4d, 0xad, 0xab, 0x43, 0xed, 0xcc, 0x58, 0x28, 0x89, 0xa2, 0xa5, 0x95, 0x3c, 0x86,
-       0x70, 0x22, 0x35, 0xd6, 0x89, 0x98, 0x3e, 0x9d, 0xc9, 0xf1, 0xaf, 0xd0, 0x45, 0xb4, 0x4b, 0xae,
-       0x8d, 0xc8, 0x19, 0x72, 0xf1, 0x3f, 0x43, 0xfe, 0xd3, 0x84, 0x5d, 0xa4, 0xf0, 0x25, 0x67, 0x19,
-       0x57, 0x24, 0x82, 0x60, 0x71, 0xb0, 0x2a, 0xd1, 0x36, 0x70, 0xc8, 0xc5, 0xcd, 0x70, 0xd6, 0xc0,
-       0x52, 0x22, 0x2f, 0xa0, 0x37, 0x51, 0x7c, 0x2a, 0x64, 0xa1, 0xe7, 0xdd, 0x5a, 0x66, 0xb3, 0x53,
-       0xb9, 0x54, 0xed, 0x7a, 0x02, 0x3b, 0x46, 0x8c, 0xb9, 0x36, 0x6c, 0x3c, 0xc1, 0xe1, 0xf2, 0xe9,
-       0x5c, 0x41, 0xbe, 0x80, 0x9e, 0x51, 0x2c, 0xd7, 0x2c, 0xb5, 0x49, 0xea, 0x44, 0x49, 0x69, 0xa2,
-       0xd6, 0x52, 0xcc, 0x6e, 0xdd, 0x85, 0x4a, 0x69, 0xc8, 0x37, 0xf0, 0x71, 0x4d, 0x97, 0x68, 0xc3,
-       0x4c, 0xa1, 0x93, 0x21, 0xd3, 0xc3, 0xa8, 0xbd, 0xf4, 0xf3, 0xc3, 0x9a, 0xe3, 0x35, 0xfa, 0xe1,
-       0x96, 0x1e, 0x40, 0x2b, 0x97, 0x79, 0xca, 0xa3, 0x00, 0x53, 0x2a, 0x05, 0xbb, 0x51, 0x03, 0x61,
-       0x74, 0x14, 0xa2, 0x12, 0xbf, 0xc9, 0x25, 0x90, 0x55, 0xac, 0x68, 0x07, 0x61, 0x1e, 0x5a, 0x98,
-       0xd7, 0xcb, 0x00, 0xb4, 0xb7, 0x82, 0x19, 0xff, 0xd5, 0x80, 0xf0, 0xf5, 0xed, 0x07, 0xb9, 0x3f,
-       0x86, 0x8e, 0xe6, 0x4a, 0xb0, 0x91, 0xb8, 0xe3, 0x59, 0xa2, 0xc5, 0x1d, 0x77, 0x4d, 0xd8, 0x9b,
-       0xab, 0xaf, 0xc5, 0x1d, 0xb7, 0x47, 0x83, 0x65, 0x31, 0x51, 0x2c, 0xbf, 0xe1, 0xae, 0xd9, 0xc8,
-       0x2b, 0xb5, 0x0a, 0x72, 0x0c, 0xa0, 0xb8, 0x2e, 0x46, 0x76, 0x5b, 0x75, 0xe4, 0x1f, 0x7a, 0x0b,
-       0x9c, 0xec, 0x94, 0xb6, 0x7e, 0xa6, 0xc9, 0xa7, 0x10, 0xf2, 0x5b, 0x53, 0x52, 0xb7, 0xcc, 0x7b,
-       0xc0, 0x6f, 0x8d, 0xfd, 0x88, 0x9f, 0x41, 0x6f, 0xa5, 0x48, 0x3b, 0x26, 0x03, 0x61, 0xc6, 0x6c,
-       0x82, 0x35, 0x3c, 0xa0, 0x4e, 0x8a, 0xff, 0x6e, 0x80, 0x77, 0x55, 0xdc, 0x92, 0xcf, 0x21, 0xd0,
-       0xb8, 0x4c, 0x3a, 0x6a, 0x20, 0x3e, 0x4e, 0x6d, 0x6d, 0xc9, 0x68, 0x65, 0x27, 0x47, 0x10, 0xbc,
-       0x67, 0x93, 0x2b, 0xdb, 0x42, 0xae, 0xde, 0x3d, 0xb9, 0x92, 0x1f, 0xe1, 0xe0, 0x37, 0x61, 0x72,
-       0xae, 0x75, 0x92, 0xcd, 0xb7, 0xab, 0xe2, 0xe0, 0x60, 0x96, 0x43, 0x6d, 0xf5, 0xe8, 0xbe, 0xfb,
-       0xa3, 0xa6, 0xd3, 0xe4, 0x19, 0xf4, 0xaa, 0x40, 0x4c, 0xdd, 0x14, 0x63, 0x9e, 0x1b, 0x1d, 0xb5,
-       0x0e, 0xbd, 0xa7, 0x0f, 0x68, 0xd7, 0x19, 0x2e, 0x2a, 0xbd, 0x6d, 0x6f, 0xeb, 0x27, 0x1c, 0xa1,
-       0x5a, 0x2d, 0x8d, 0x0d, 0x6b, 0x69, 0xde, 0x57, 0xcb, 0xda, 0x14, 0xbc, 0xf5, 0x29, 0x90, 0xaf,
-       0x60, 0x7f, 0xe6, 0x9c, 0xa7, 0x43, 0xa9, 0x78, 0x66, 0x17, 0xd4, 0x5f, 0x0a, 0x5e, 0x45, 0xbc,
-       0x70, 0x3e, 0xfd, 0x2c, 0x96, 0x10, 0x7e, 0x27, 0x45, 0x3e, 0x60, 0x9a, 0x93, 0xef, 0xe7, 0x51,
-       0x6a, 0xf4, 0xb9, 0x52, 0xd6, 0xb3, 0x47, 0x56, 0xd9, 0xb3, 0x5b, 0xcf, 0xd4, 0x40, 0x18, 0xc5,
-       0xd4, 0xef, 0xee, 0x7e, 0x9a, 0x2b, 0xe2, 0x77, 0x0d, 0x68, 0xff, 0x5c, 0x98, 0x49, 0x61, 0xc8,
-       0x31, 0xb4, 0xcb, 0x29, 0x70, 0x10, 0x2b, 0x43, 0xe2, 0xcc, 0xe4, 0x05, 0x74, 0x52, 0x99, 0x1b,
-       0x25, 0x47, 0xef, 0x3b, 0xf5, 0xf7, 0x9c, 0xcf, 0xab, 0x6d, 0x46, 0x26, 0x82, 0x40, 0xaa, 0x4c,
-       0xe4, 0x6c, 0xe4, 0x0e, 0xa8, 0x4a, 0x8c, 0x0d, 0x00, 0xe5, 0x46, 0x28, 0x6e, 0x29, 0xde, 0x3c,
-       0xd7, 0x8d, 0x9a, 0x5b, 0x43, 0xf5, 0x16, 0x51, 0xff, 0xf0, 0x20, 0xec, 0xbb, 0xdb, 0x8b, 0x1c,
-       0xc1, 0x4e, 0xd9, 0xce, 0x75, 0x77, 0x63, 0x58, 0x9a, 0xfa, 0xd9, 0xa6, 0x37, 0xc4, 0x46, 0x7c,
-       0xdc, 0x33, 0x03, 0xfe, 0x96, 0x33, 0x70, 0x05, 0xd1, 0x6c, 0x20, 0xf1, 0xe1, 0x90, 0xcd, 0x2e,
-       0x7e, 0x77, 0xd4, 0xec, 0xcf, 0xb2, 0x9c, 0xbf, 0x09, 0xe8, 0xa3, 0x6a, 0x40, 0x97, 0xde, 0x0a,
-       0x6b, 0x97, 0xa1, 0xbd, 0xdd, 0x32, 0x04, 0x1f, 0x5c, 0x86, 0x7a, 0x5b, 0xc2, 0xc5, 0xb6, 0xbc,
-       0x6b, 0x42, 0xeb, 0x7a, 0xc2, 0xf3, 0x8c, 0x9c, 0x42, 0x47, 0x4f, 0x78, 0x6e, 0x12, 0x89, 0x43,
-       0xbc, 0xae, 0x33, 0x1f, 0xa1, 0x43, 0x39, 0xe4, 0xfd, 0x6c, 0xb3, 0x89, 0xb8, 0x87, 0x77, 0x6f,
-       0x4b, 0xde, 0xd7, 0x12, 0xe5, 0x6f, 0x47, 0x54, 0x6b, 0x2b, 0xa2, 0xda, 0x0b, 0x44, 0x0d, 0xda,
-       0xf8, 0x28, 0x3e, 0xff, 0x37, 0x00, 0x00, 0xff, 0xff, 0xe1, 0xbb, 0x5f, 0x43, 0x20, 0x0b, 0x00,
-       0x00,
+       // 951 bytes of a gzipped FileDescriptorProto
+       0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x6e, 0xe3, 0x44,
+       0x14, 0x56, 0x62, 0x27, 0x76, 0x4e, 0x4a, 0xd3, 0x4c, 0xbb, 0x8b, 0xb5, 0x5a, 0xa4, 0xca, 0xa8,
+       0x74, 0xd1, 0x4a, 0x55, 0xb7, 0x5d, 0x10, 0x17, 0x5c, 0x50, 0x28, 0xb0, 0xb9, 0x28, 0xac, 0xa6,
+       0xab, 0xbd, 0xb5, 0xc6, 0xf6, 0x6c, 0x32, 0x22, 0xf1, 0x98, 0x99, 0x71, 0x28, 0x7d, 0x0e, 0x9e,
+       0x61, 0x1f, 0x82, 0xc7, 0xe2, 0x9a, 0x0b, 0x34, 0xe3, 0x71, 0xec, 0xfc, 0x94, 0x4d, 0x84, 0xb8,
+       0xf3, 0x39, 0x73, 0x7c, 0x7e, 0xbe, 0xf3, 0x7d, 0x1e, 0x83, 0x1f, 0x27, 0x67, 0xb9, 0xe0, 0x8a,
+       0xa3, 0x76, 0x9c, 0x84, 0x3f, 0x80, 0xfb, 0x8a, 0xc8, 0x09, 0xda, 0x87, 0xf6, 0xfc, 0x3c, 0x68,
+       0x1d, 0xb7, 0x9e, 0x75, 0x71, 0x7b, 0x7e, 0x6e, 0xec, 0x17, 0x41, 0xdb, 0xda, 0x2f, 0x8c, 0x7d,
+       0x11, 0x38, 0xd6, 0xbe, 0x30, 0xf6, 0x65, 0xe0, 0x5a, 0xfb, 0x32, 0xfc, 0x1a, 0xbc, 0xd7, 0x82,
+       0x8f, 0x05, 0x99, 0xa1, 0x4f, 0x00, 0xe6, 0xb3, 0x68, 0x4e, 0x85, 0x64, 0x3c, 0x33, 0x29, 0x5d,
+       0xdc, 0x9b, 0xcf, 0xde, 0x96, 0x0e, 0x84, 0xc0, 0x4d, 0x78, 0x4a, 0x4d, 0xee, 0x3d, 0x6c, 0x9e,
+       0xc3, 0x11, 0x78, 0x57, 0x52, 0x52, 0x35, 0xba, 0xfe, 0xcf, 0x8d, 0xdc, 0x40, 0xdf, 0xa4, 0xba,
+       0x9a, 0xf1, 0x22, 0x53, 0xe8, 0x33, 0xf0, 0x89, 0x36, 0x23, 0x96, 0x9a, 0xa4, 0xfd, 0x8b, 0xfe,
+       0x59, 0x9c, 0x9c, 0xd9, 0x6a, 0xd8, 0x33, 0x87, 0xa3, 0x14, 0x3d, 0x86, 0x2e, 0x31, 0x6f, 0x98,
+       0x52, 0x2e, 0xb6, 0x56, 0x38, 0x86, 0x81, 0x89, 0xbd, 0xa6, 0xef, 0x58, 0xc6, 0x94, 0x1e, 0xe0,
+       0x4b, 0x38, 0x60, 0x52, 0x16, 0x24, 0x4b, 0x68, 0x94, 0x97, 0x33, 0x37, 0x53, 0x5b, 0x18, 0xf0,
+       0xa0, 0x0a, 0xaa, 0x70, 0x79, 0x0a, 0x6e, 0x4a, 0x14, 0x31, 0x05, 0xfa, 0x17, 0xbe, 0x8e, 0xd5,
+       0xd0, 0x63, 0xe3, 0x0d, 0xa7, 0xd0, 0x7f, 0x4b, 0xa6, 0x05, 0xbd, 0xe5, 0x85, 0x48, 0x28, 0x7a,
+       0x02, 0x8e, 0xa0, 0xef, 0x6c, 0xde, 0x3a, 0x56, 0x3b, 0xd1, 0x09, 0x74, 0xe6, 0x3a, 0xd4, 0x66,
+       0x1a, 0x2c, 0x06, 0x2a, 0x67, 0xc6, 0xe5, 0x29, 0x7a, 0x02, 0x7e, 0xce, 0xa5, 0xe9, 0xd9, 0xe0,
+       0xe5, 0xe2, 0x85, 0x1d, 0xfe, 0x0a, 0x07, 0xa6, 0xda, 0x35, 0x95, 0x8a, 0x65, 0xc4, 0xcc, 0xf5,
+       0x3f, 0x97, 0xfc, 0xbb, 0x0d, 0xfd, 0x6f, 0xa7, 0x3c, 0xf9, 0xe5, 0x15, 0x25, 0x29, 0x15, 0x28,
+       0x00, 0x6f, 0x99, 0x23, 0x95, 0xa9, 0x77, 0x31, 0xa1, 0x6c, 0x3c, 0x59, 0xec, 0xa2, 0xb4, 0xd0,
+       0x4b, 0x18, 0xe6, 0x82, 0xce, 0x19, 0x2f, 0x64, 0x14, 0xeb, 0x4c, 0x7a, 0xa9, 0xce, 0x4a, 0xbb,
+       0x83, 0x2a, 0xc4, 0xd4, 0x1a, 0xa5, 0xe8, 0x29, 0xf4, 0x14, 0x9b, 0x51, 0xa9, 0xc8, 0x2c, 0x37,
+       0x3c, 0x71, 0x71, 0xed, 0x40, 0x5f, 0xc0, 0x50, 0x09, 0x92, 0x49, 0x92, 0xe8, 0x26, 0x65, 0x24,
+       0x38, 0x57, 0x41, 0x67, 0x25, 0xe7, 0x41, 0x33, 0x04, 0x73, 0xae, 0xd0, 0x37, 0xf0, 0x71, 0xc3,
+       0x17, 0x49, 0x45, 0x54, 0x21, 0xa3, 0x09, 0x91, 0x93, 0xa0, 0xbb, 0xf2, 0xf2, 0xa3, 0x46, 0xe0,
+       0xad, 0x89, 0x33, 0x82, 0x3b, 0x82, 0x4e, 0xc6, 0xb3, 0x84, 0x06, 0x9e, 0x69, 0xa9, 0x34, 0xb4,
+       0x38, 0x62, 0xa6, 0x64, 0xe0, 0x1b, 0xa7, 0x79, 0x46, 0xd7, 0x80, 0xd6, 0x6b, 0x05, 0x3d, 0x53,
+       0xe6, 0x91, 0x2e, 0xf3, 0x66, 0xb5, 0x00, 0x1e, 0xae, 0xd5, 0x0c, 0xff, 0x6c, 0x81, 0xff, 0xe6,
+       0xee, 0x83, 0xd8, 0x9f, 0xc2, 0x40, 0x52, 0xc1, 0xc8, 0x94, 0xdd, 0xd3, 0x34, 0x92, 0xec, 0x9e,
+       0xda, 0x25, 0xec, 0xd7, 0xee, 0x5b, 0x76, 0x4f, 0xb5, 0xca, 0x35, 0x8a, 0x91, 0x20, 0xd9, 0x98,
+       0xda, 0x65, 0x1b, 0x5c, 0xb1, 0x76, 0xa0, 0x53, 0x00, 0x41, 0x65, 0x31, 0xd5, 0xc2, 0x93, 0x81,
+       0x7b, 0xec, 0x2c, 0x61, 0xd2, 0x2b, 0xcf, 0x46, 0xa9, 0x44, 0x9f, 0x82, 0x4f, 0xef, 0x54, 0x09,
+       0xdd, 0x2a, 0xee, 0x1e, 0xbd, 0x53, 0xfa, 0x21, 0x7c, 0x0e, 0xc3, 0xb5, 0x21, 0x35, 0x4d, 0x62,
+       0xa6, 0x66, 0x24, 0x37, 0x33, 0xec, 0x61, 0x6b, 0x85, 0x7f, 0xb5, 0xc0, 0xb9, 0x29, 0xee, 0xd0,
+       0xe7, 0xe0, 0x49, 0x23, 0x26, 0x19, 0xb4, 0x4c, 0x7d, 0xc3, 0xda, 0x86, 0xc8, 0x70, 0x75, 0x8e,
+       0x4e, 0xc0, 0xab, 0x94, 0xdc, 0x5e, 0x57, 0x72, 0x75, 0xb6, 0xd4, 0xab, 0xf3, 0x40, 0xaf, 0xe8,
+       0x47, 0x38, 0xfa, 0x8d, 0xa9, 0x8c, 0x4a, 0x19, 0xa5, 0xb5, 0xba, 0x2a, 0x0c, 0x8e, 0x16, 0x3d,
+       0x34, 0xa4, 0x87, 0x0f, 0xed, 0x1b, 0x0d, 0x9f, 0x44, 0xcf, 0x61, 0x58, 0x25, 0x22, 0x62, 0x5c,
+       0xcc, 0x68, 0xa6, 0x64, 0xd0, 0x39, 0x76, 0x9e, 0xed, 0xe1, 0x03, 0x7b, 0x70, 0x55, 0xf9, 0xf5,
+       0x7a, 0x3b, 0x3f, 0x19, 0x0a, 0x35, 0x66, 0x69, 0x6d, 0x39, 0x4b, 0xfb, 0xa1, 0x59, 0x36, 0xb6,
+       0xe0, 0x6c, 0x6e, 0x01, 0x7d, 0x05, 0x87, 0x8b, 0xe0, 0x2c, 0x99, 0x70, 0x41, 0x53, 0x2d, 0x50,
+       0x77, 0x25, 0x79, 0x95, 0xf1, 0xca, 0xc6, 0x8c, 0xd2, 0x90, 0x83, 0xff, 0x1d, 0x67, 0x59, 0x4c,
+       0x24, 0x45, 0xdf, 0xd7, 0x59, 0x1a, 0xf0, 0xd9, 0x51, 0x36, 0xa3, 0x87, 0xd6, 0xd1, 0xd3, 0xaa,
+       0x27, 0x22, 0x66, 0x4a, 0x10, 0xf1, 0xbb, 0xbd, 0x6a, 0x6a, 0x47, 0xf8, 0xbe, 0x05, 0xdd, 0x9f,
+       0x0b, 0x95, 0x17, 0x0a, 0x9d, 0x42, 0xb7, 0x64, 0x81, 0x2d, 0xb1, 0x46, 0x12, 0x7b, 0x8c, 0x5e,
+       0xc2, 0x20, 0xe1, 0x99, 0x12, 0x7c, 0x1a, 0xfd, 0x0b, 0x57, 0xf6, 0x6d, 0xcc, 0xeb, 0x5d, 0x28,
+       0x13, 0x80, 0xc7, 0x45, 0xca, 0x32, 0x32, 0xb5, 0x1f, 0xa8, 0xca, 0x0c, 0x15, 0x00, 0xa6, 0x8a,
+       0x09, 0xaa, 0x21, 0xde, 0xbe, 0xd7, 0xad, 0x96, 0xdb, 0xa8, 0xea, 0x2c, 0x57, 0xfd, 0xc3, 0x01,
+       0x7f, 0x64, 0x6f, 0x2f, 0x74, 0x02, 0xbd, 0x72, 0x9d, 0xf5, 0x15, 0x5a, 0x27, 0xf3, 0xcb, 0xa3,
+       0x51, 0xba, 0xed, 0x0d, 0xb1, 0x15, 0x1e, 0x0f, 0x70, 0xc0, 0xdd, 0x91, 0x03, 0x37, 0x10, 0x2c,
+       0x08, 0x69, 0xfe, 0x01, 0xd2, 0xc5, 0x25, 0x6e, 0x3f, 0x35, 0x87, 0x8b, 0x2e, 0xeb, 0xfb, 0x1d,
+       0x3f, 0xae, 0x08, 0xba, 0x72, 0xef, 0x6f, 0x14, 0x43, 0x77, 0x37, 0x31, 0x78, 0x1f, 0x14, 0x43,
+       0x73, 0x2d, 0xfe, 0xf2, 0x5a, 0xde, 0xb7, 0xa1, 0x73, 0x9b, 0xd3, 0x2c, 0x45, 0xe7, 0x30, 0x90,
+       0x39, 0xcd, 0x54, 0xc4, 0x0d, 0x89, 0x37, 0x6d, 0xe6, 0x23, 0x13, 0x50, 0x92, 0x7c, 0x94, 0x6e,
+       0xc7, 0x88, 0x07, 0x70, 0x77, 0x76, 0xc4, 0x7d, 0x23, 0x50, 0xee, 0x6e, 0x40, 0x75, 0x76, 0x02,
+       0xaa, 0xbb, 0x04, 0x54, 0xdc, 0x35, 0xff, 0xb7, 0x97, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xeb,
+       0x55, 0xfc, 0x14, 0xeb, 0x0a, 0x00, 0x00,
 }
index 9875efc..e67fe51 100644 (file)
@@ -32,9 +32,8 @@ message AssetAmount {
 }
 
 message AssetDefinition {
-  Hash    initial_block_id = 1;
-  Program issuance_program = 2;
-  Hash    data             = 3;
+  Program issuance_program = 1;
+  Hash    data             = 2;
 }
 
 message ValueSource {
index 89e697b..d2758b6 100644 (file)
@@ -46,7 +46,7 @@ func NewIssuanceTx(tb testing.TB, initial bc.Hash, opts ...func(*legacy.Tx)) *le
                testutil.FatalErr(tb, err)
        }
        assetdef := []byte(`{"type": "prottest issuance"}`)
-       txin := legacy.NewIssuanceInput(nonce[:], 100, initial, issuanceProgram, nil, assetdef)
+       txin := legacy.NewIssuanceInput(nonce[:], 100, issuanceProgram, nil, assetdef)
 
        tx := legacy.NewTx(legacy.TxData{
                Version: 1,
index 57cd3ad..95e7f54 100644 (file)
@@ -3,7 +3,7 @@ package legacy
 import "testing"
 
 func TestFuzzUnknownAssetVersion(t *testing.T) {
-       const rawTx = `0701000001012b00030a0908fa48ca4e0150f83fbf26cf83211d136313cde98601a667d999ab9cc27b723d4680a094a58d1d2903deff1d4319d67baa10a6d26c1fea9c3e8d30e33474efee1a610a9bb49d758d000101010103010203010129000000000000000000000000000000000000000000000000000000000000000080a094a58d1d01010100`
+       const rawTx = `0701000001012b00030a0908916133a0d64d1d973b631e226ef95338ad4a536b95635f32f0d04708a6f2a26380a094a58d1d09000101010103010203010129000000000000000000000000000000000000000000000000000000000000000080a094a58d1d01010100`
 
        var want Tx
        err := want.UnmarshalText([]byte(rawTx))
index 6a9f4f3..91fb56f 100644 (file)
@@ -24,7 +24,7 @@ func (ii *IssuanceInput) IsCoinbase() bool { return false }
 
 func (ii *IssuanceInput) AssetID() bc.AssetID {
        defhash := ii.AssetDefinitionHash()
-       return bc.ComputeAssetID(ii.IssuanceProgram, &ii.InitialBlock, ii.VMVersion, &defhash)
+       return bc.ComputeAssetID(ii.IssuanceProgram, ii.VMVersion, &defhash)
 }
 
 func (ii *IssuanceInput) AssetDefinitionHash() (defhash bc.Hash) {
@@ -38,7 +38,6 @@ func (ii *IssuanceInput) AssetDefinitionHash() (defhash bc.Hash) {
 func NewIssuanceInput(
        nonce []byte,
        amount uint64,
-       initialBlock bc.Hash,
        issuanceProgram []byte,
        arguments [][]byte,
        assetDefinition []byte,
@@ -49,7 +48,6 @@ func NewIssuanceInput(
                        Nonce:  nonce,
                        Amount: amount,
                        IssuanceWitness: IssuanceWitness{
-                               InitialBlock:    initialBlock,
                                AssetDefinition: assetDefinition,
                                VMVersion:       1,
                                IssuanceProgram: issuanceProgram,
index f5a7ec0..098e9d3 100644 (file)
@@ -1,9 +1,6 @@
 package legacy
 
-import "github.com/bytom/protocol/bc"
-
 type IssuanceWitness struct {
-       InitialBlock    bc.Hash
        AssetDefinition []byte
        VMVersion       uint64
        IssuanceProgram []byte
index 2656e7e..7ae12b7 100644 (file)
@@ -146,7 +146,6 @@ func mapTx(tx *TxData) (headerID bc.Hash, hdr *bc.TxHeader, entryMap map[bc.Hash
                        assetdefhash := hashData(oldIss.AssetDefinition)
                        iss := bc.NewIssuance(&anchorID, &val, uint64(i))
                        iss.WitnessAssetDefinition = &bc.AssetDefinition{
-                               InitialBlockId: &oldIss.InitialBlock,
                                Data:           &assetdefhash,
                                IssuanceProgram: &bc.Program{
                                        VmVersion: oldIss.VMVersion,
index fc45dfc..ad26ca3 100644 (file)
@@ -16,7 +16,7 @@ import (
 )
 
 func TestTransactionTrailingGarbage(t *testing.T) {
-       const validTxHex = `0701000001012b00030a0908fa48ca4e0150f83fbf26cf83211d136313cde98601a667d999ab9cc27b723d4680a094a58d1d2903deff1d4319d67baa10a6d26c1fea9c3e8d30e33474efee1a610a9bb49d758d000101010103010203010129000000000000000000000000000000000000000000000000000000000000000080a094a58d1d01010100`
+       const validTxHex = `0701000001012b00030a0908916133a0d64d1d973b631e226ef95338ad4a536b95635f32f0d04708a6f2a26380a094a58d1d09000101010103010203010129000000000000000000000000000000000000000000000000000000000000000080a094a58d1d01010100`
 
        var validTx Tx
        err := validTx.UnmarshalText([]byte(validTxHex))
@@ -34,10 +34,8 @@ func TestTransactionTrailingGarbage(t *testing.T) {
 
 func TestTransaction(t *testing.T) {
        issuanceScript := []byte{1}
-       initialBlockHashHex := "03deff1d4319d67baa10a6d26c1fea9c3e8d30e33474efee1a610a9bb49d758d"
-       initialBlockHash := mustDecodeHash(initialBlockHashHex)
 
-       assetID := bc.ComputeAssetID(issuanceScript, &initialBlockHash, 1, &bc.EmptyStringHash)
+       assetID := bc.ComputeAssetID(issuanceScript, 1, &bc.EmptyStringHash)
 
        cases := []struct {
                tx   *Tx
@@ -62,16 +60,16 @@ func TestTransaction(t *testing.T) {
                {
                        tx: NewTx(TxData{
                                Version:        1,
-                               SerializedSize: uint64(137),
+                               SerializedSize: uint64(105),
                                Inputs: []*TxInput{
-                                       NewIssuanceInput([]byte{10, 9, 8}, 1000000000000, initialBlockHash, issuanceScript, [][]byte{[]byte{1, 2, 3}}, nil),
+                                       NewIssuanceInput([]byte{10, 9, 8}, 1000000000000, issuanceScript, [][]byte{[]byte{1, 2, 3}}, nil),
                                },
                                Outputs: []*TxOutput{
                                        NewTxOutput(bc.AssetID{}, 1000000000000, []byte{1}),
                                },
                        }),
-                       hex: ("0701000001012b00030a0908fa48ca4e0150f83fbf26cf83211d136313cde98601a667d999ab9cc27b723d4680a094a58d1d2903deff1d4319d67baa10a6d26c1fea9c3e8d30e33474efee1a610a9bb49d758d000101010103010203010129000000000000000000000000000000000000000000000000000000000000000080a094a58d1d01010100"), // reference data
-                       hash: mustDecodeHash("1cc75450adcfb8c605dc5719fce3d05646aee8ebe886b62d83d749b597d72ac4"),
+                       hex: ("0701000001012b00030a0908916133a0d64d1d973b631e226ef95338ad4a536b95635f32f0d04708a6f2a26380a094a58d1d09000101010103010203010129000000000000000000000000000000000000000000000000000000000000000080a094a58d1d01010100"), // reference data
+                       hash: mustDecodeHash("7e6928130bc91e115f6ebe1fb4238d51e4155a7f9f809a36a5ebea7342ad1f63"),
                },
                {
                        tx: NewTx(TxData{
@@ -85,8 +83,8 @@ func TestTransaction(t *testing.T) {
                                        NewTxOutput(assetID, 400000000000, []byte{2}),
                                },
                        }),
-                       hex: ("0701000001014c014add385f6fe25d91d8c1bd0fa58951ad56b0c5229dcc01f61d9f9e8b9eb92d3292000000000000000000000000000000000000000000000000000000000000000080a094a58d1d010101010100020129fa48ca4e0150f83fbf26cf83211d136313cde98601a667d999ab9cc27b723d4680e0a596bb11010101000129fa48ca4e0150f83fbf26cf83211d136313cde98601a667d999ab9cc27b723d4680c0ee8ed20b01010200"), // output 1, output witness
-                       hash: mustDecodeHash("828b56bb1946e8fe04e4dffd6b856d3a5ded4c96d05464d3d2ceb470c1620bc4"),
+                       hex: ("0701000001014c014add385f6fe25d91d8c1bd0fa58951ad56b0c5229dcc01f61d9f9e8b9eb92d3292000000000000000000000000000000000000000000000000000000000000000080a094a58d1d010101010100020129916133a0d64d1d973b631e226ef95338ad4a536b95635f32f0d04708a6f2a26380e0a596bb11010101000129916133a0d64d1d973b631e226ef95338ad4a536b95635f32f0d04708a6f2a26380c0ee8ed20b01010200"), // output 1, output witness
+                       hash: mustDecodeHash("e89ea19ec8acb92d697c06ebf841020bb9f1d9ace983efcb47c09913cff99026"),
                },
        }
        for i, test := range cases {
@@ -127,14 +125,14 @@ func TestHasIssuance(t *testing.T) {
                want bool
        }{{
                tx: &TxData{
-                       Inputs: []*TxInput{NewIssuanceInput(nil, 0, bc.Hash{}, nil, nil, nil)},
+                       Inputs: []*TxInput{NewIssuanceInput(nil, 0, nil, nil, nil)},
                },
                want: true,
        }, {
                tx: &TxData{
                        Inputs: []*TxInput{
                                NewSpendInput(nil, bc.Hash{}, bc.AssetID{}, 0, 0, nil),
-                               NewIssuanceInput(nil, 0, bc.Hash{}, nil, nil, nil),
+                               NewIssuanceInput(nil, 0, nil, nil, nil),
                        },
                },
                want: true,
index 32d5fe9..fa31bc9 100644 (file)
@@ -19,7 +19,7 @@ func TestTxHashes(t *testing.T) {
                },
                {
                        txdata: sampleTx(),
-                       hash:   mustDecodeHash("33c121707a5c5567ed2c0a63da1fbc4077d51bc367b9630c664bfc241b51e641"), // todo: verify this value,
+                       hash:   mustDecodeHash("718ef8d06b8a2b9e93d6c1555bfcda83aed492643b4e7dd85b816fa13ced46b9"), // todo: verify this value,
                },
        }
 
@@ -49,8 +49,7 @@ func BenchmarkHashNonemptyTx(b *testing.B) {
 }
 
 func sampleTx() *TxData {
-       initialBlockHash := mustDecodeHash("03deff1d4319d67baa10a6d26c1fea9c3e8d30e33474efee1a610a9bb49d758d")
-       assetID := bc.ComputeAssetID([]byte{1}, &initialBlockHash, 1, &bc.EmptyStringHash)
+       assetID := bc.ComputeAssetID([]byte{1}, 1, &bc.EmptyStringHash)
        return &TxData{
                Version:        1,
                SerializedSize: 66,
index c97d25b..159f120 100644 (file)
@@ -159,10 +159,6 @@ func (t *TxInput) readFrom(r *blockchain.Reader) (err error) {
 
                if ii != nil {
                        // read IssuanceInput witness
-                       if _, err = ii.InitialBlock.ReadFrom(r); err != nil {
-                               return err
-                       }
-
                        ii.AssetDefinition, err = blockchain.ReadVarstr31(r)
                        if err != nil {
                                return err
@@ -276,11 +272,7 @@ func (t *TxInput) writeInputWitness(w io.Writer) error {
        }
        switch inp := t.TypedInput.(type) {
        case *IssuanceInput:
-               _, err := inp.InitialBlock.WriteTo(w)
-               if err != nil {
-                       return err
-               }
-               _, err = blockchain.WriteVarstr31(w, inp.AssetDefinition)
+               _, err := blockchain.WriteVarstr31(w, inp.AssetDefinition)
                if err != nil {
                        return err
                }
index 2418111..9a55ad3 100644 (file)
@@ -15,7 +15,7 @@ func TestMerkleRoot(t *testing.T) {
                want      Hash
        }{{
                witnesses: [][][]byte{
-                       [][]byte{
+                       {
                                {1},
                                []byte("00000"),
                        },
@@ -23,11 +23,11 @@ func TestMerkleRoot(t *testing.T) {
                want: mustDecodeHash("dd26282725467a18bf98ed14e022da9493436dd09372cfeae13080cbaaded00f"),
        }, {
                witnesses: [][][]byte{
-                       [][]byte{
+                       {
                                {1},
                                []byte("000000"),
                        },
-                       [][]byte{
+                       {
                                {1},
                                []byte("111111"),
                        },
@@ -35,11 +35,11 @@ func TestMerkleRoot(t *testing.T) {
                want: mustDecodeHash("a112fb9aea40e6d8b2e9f443ec326d49bea7b61cd616b4bddeb9ebb010e76bf5"),
        }, {
                witnesses: [][][]byte{
-                       [][]byte{
+                       {
                                {1},
                                []byte("000000"),
                        },
-                       [][]byte{
+                       {
                                {2},
                                []byte("111111"),
                                []byte("222222"),
@@ -79,15 +79,14 @@ func TestMerkleRoot(t *testing.T) {
 }
 
 func TestDuplicateLeaves(t *testing.T) {
-       var initialBlockHash Hash
        trueProg := []byte{byte(vm.OP_TRUE)}
-       assetID := ComputeAssetID(trueProg, &initialBlockHash, 1, &EmptyStringHash)
+       assetID := ComputeAssetID(trueProg, 1, &EmptyStringHash)
        txs := make([]*Tx, 6)
        for i := uint64(0); i < 6; i++ {
                now := []byte(time.Now().String())
                txs[i] = legacy.NewTx(legacy.TxData{
                        Version: 1,
-                       Inputs:  []*legacy.TxInput{legacy.NewIssuanceInput(now, i, initialBlockHash, trueProg, nil, nil)},
+                       Inputs:  []*legacy.TxInput{legacy.NewIssuanceInput(now, i, trueProg, nil, nil)},
                        Outputs: []*legacy.TxOutput{legacy.NewTxOutput(assetID, i, trueProg)},
                }).Tx
        }
@@ -112,11 +111,10 @@ func TestDuplicateLeaves(t *testing.T) {
 }
 
 func TestAllDuplicateLeaves(t *testing.T) {
-       var initialBlockHash Hash
        trueProg := []byte{byte(vm.OP_TRUE)}
-       assetID := ComputeAssetID(trueProg, &initialBlockHash, 1, &EmptyStringHash)
+       assetID := ComputeAssetID(trueProg, 1, &EmptyStringHash)
        now := []byte(time.Now().String())
-       issuanceInp := legacy.NewIssuanceInput(now, 1, initialBlockHash, trueProg, nil, nil)
+       issuanceInp := legacy.NewIssuanceInput(now, 1, trueProg, nil, nil)
 
        tx := legacy.NewTx(legacy.TxData{
                Version: 1,
index 5390402..8b9d268 100644 (file)
@@ -65,8 +65,7 @@ type testAsset struct {
 func newAsset(t testing.TB) *testAsset {
        dest := newDest(t)
        cp, _ := dest.controlProgram()
-       var initialBlockID bc.Hash
-       assetID := bc.ComputeAssetID(cp, &initialBlockID, 1, &bc.EmptyStringHash)
+       assetID := bc.ComputeAssetID(cp, 1, &bc.EmptyStringHash)
 
        return &testAsset{
                AssetID:  assetID,
@@ -86,7 +85,7 @@ func issue(t testing.TB, asset *testAsset, dest *testDest, amount uint64) (*lega
        tx := legacy.NewTx(legacy.TxData{
                Version: 1,
                Inputs: []*legacy.TxInput{
-                       legacy.NewIssuanceInput([]byte{1}, amount, bc.Hash{}, assetCP, nil, nil),
+                       legacy.NewIssuanceInput([]byte{1}, amount, assetCP, nil, nil),
                },
                Outputs: []*legacy.TxOutput{
                        legacy.NewTxOutput(asset.AssetID, amount, destCP),
index 67059fd..065aa75 100644 (file)
@@ -573,7 +573,7 @@ func sample(tb testing.TB, in *txFixture) *txFixture {
        }
        if result.assetID.IsZero() {
                refdatahash := hashData(result.assetDef)
-               result.assetID = bc.ComputeAssetID(result.issuanceProg.Code, &result.initialBlockID, result.issuanceProg.VmVersion, &refdatahash)
+               result.assetID = bc.ComputeAssetID(result.issuanceProg.Code, result.issuanceProg.VmVersion, &refdatahash)
        }
 
        if result.txVersion == 0 {
@@ -593,7 +593,7 @@ func sample(tb testing.TB, in *txFixture) *txFixture {
                args2 := [][]byte{[]byte{6}, []byte{7}}
 
                result.txInputs = []*legacy.TxInput{
-                       legacy.NewIssuanceInput([]byte{3}, 10, result.initialBlockID, result.issuanceProg.Code, result.issuanceArgs, result.assetDef),
+                       legacy.NewIssuanceInput([]byte{3}, 10, result.issuanceProg.Code, result.issuanceArgs, result.assetDef),
                        legacy.NewSpendInput(args1, *newHash(5), result.assetID, 20, 0, cp1),
                        legacy.NewSpendInput(args2, *newHash(8), result.assetID, 40, 0, cp2),
                }
index 63e12d2..a8da9ac 100644 (file)
@@ -14,7 +14,7 @@ func TestCheckOutput(t *testing.T) {
        tx := legacy.NewTx(legacy.TxData{
                Inputs: []*legacy.TxInput{
                        legacy.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendprog")),
-                       legacy.NewIssuanceInput(nil, 6, bc.Hash{}, []byte("issueprog"), nil, nil),
+                       legacy.NewIssuanceInput(nil, 6, []byte("issueprog"), nil, nil),
                },
                Outputs: []*legacy.TxOutput{
                        legacy.NewTxOutput(bc.NewAssetID([32]byte{3}), 8, []byte("wrongprog")),