OSDN Git Service

Remove transaction reference data (#416)
authorYongfeng LI <wliyongfeng@gmail.com>
Tue, 13 Mar 2018 02:19:32 +0000 (10:19 +0800)
committerPaladz <yzhu101@uottawa.ca>
Tue, 13 Mar 2018 02:19:32 +0000 (10:19 +0800)
* remove transaction level ReferenceData

* remove setTxRefDataAction

* remove ExtHash in TxHeader

* fix the unit wallet unit test

* remove the vm txdata opcode

* clean the txbuild due to we don't have txData any more

27 files changed:
blockchain/transact.go
blockchain/txbuilder/actions.go
blockchain/txbuilder/builder.go
blockchain/txbuilder/constraint.go
blockchain/txbuilder/signature_program.go
blockchain/txbuilder/txbuilder_test.go
blockchain/wallet/annotated.go
blockchain/wallet/wallet_test.go
config/genesis.go
protocol/bc/bc.pb.go
protocol/bc/bc.proto
protocol/bc/entry_test.go
protocol/bc/legacy/block_test.go
protocol/bc/legacy/fuzz_test.go
protocol/bc/legacy/map.go
protocol/bc/legacy/transaction.go
protocol/bc/legacy/transaction_test.go
protocol/bc/legacy/tx_test.go
protocol/bc/merkle_test.go
protocol/bc/txheader.go
protocol/validation/validation_test.go
protocol/validation/vmcontext.go
protocol/validation/vmcontext_test.go
protocol/vm/context.go
protocol/vm/introspection.go
protocol/vm/introspection_test.go
protocol/vm/ops.go

index 3d21fa7..50e7a54 100644 (file)
@@ -35,8 +35,6 @@ func (bcr *BlockchainReactor) actionDecoder(action string) (func([]byte) (txbuil
                decoder = bcr.accounts.DecodeSpendAction
        case "spend_account_unspent_output":
                decoder = bcr.accounts.DecodeSpendUTXOAction
                decoder = bcr.accounts.DecodeSpendAction
        case "spend_account_unspent_output":
                decoder = bcr.accounts.DecodeSpendUTXOAction
-       case "set_transaction_reference_data":
-               decoder = txbuilder.DecodeSetTxRefDataAction
        default:
                return nil, false
        }
        default:
                return nil, false
        }
index 066ceef..cadd0e4 100644 (file)
@@ -126,24 +126,6 @@ func (a *controlProgramAction) Build(ctx context.Context, b *TemplateBuilder) er
        return b.AddOutput(out)
 }
 
        return b.AddOutput(out)
 }
 
-// DecodeSetTxRefDataAction convert input data to action struct
-func DecodeSetTxRefDataAction(data []byte) (Action, error) {
-       a := new(setTxRefDataAction)
-       err := stdjson.Unmarshal(data, a)
-       return a, err
-}
-
-type setTxRefDataAction struct {
-       Data json.Map `json:"reference_data"`
-}
-
-func (a *setTxRefDataAction) Build(ctx context.Context, b *TemplateBuilder) error {
-       if len(a.Data) == 0 {
-               return MissingFieldsError("reference_data")
-       }
-       return b.setReferenceData(a.Data)
-}
-
 // DecodeRetireAction convert input data to action struct
 func DecodeRetireAction(data []byte) (Action, error) {
        a := new(retireAction)
 // DecodeRetireAction convert input data to action struct
 func DecodeRetireAction(data []byte) (Action, error) {
        a := new(retireAction)
index 420c0da..b8b4be0 100755 (executable)
@@ -1,7 +1,6 @@
 package txbuilder
 
 import (
 package txbuilder
 
 import (
-       "bytes"
        "math"
        "time"
 
        "math"
        "time"
 
@@ -75,17 +74,6 @@ func (b *TemplateBuilder) OnBuild(buildFn func() error) {
        b.callbacks = append(b.callbacks, buildFn)
 }
 
        b.callbacks = append(b.callbacks, buildFn)
 }
 
-func (b *TemplateBuilder) setReferenceData(data []byte) error {
-       if b.base != nil && len(b.base.ReferenceData) != 0 && !bytes.Equal(b.base.ReferenceData, data) {
-               return errors.Wrap(ErrBadRefData)
-       }
-       if len(b.referenceData) != 0 && !bytes.Equal(b.referenceData, data) {
-               return errors.Wrap(ErrBadRefData)
-       }
-       b.referenceData = data
-       return nil
-}
-
 func (b *TemplateBuilder) rollback() {
        for _, f := range b.rollbacks {
                f()
 func (b *TemplateBuilder) rollback() {
        for _, f := range b.rollbacks {
                f()
@@ -110,11 +98,6 @@ func (b *TemplateBuilder) Build() (*Template, *legacy.TxData, error) {
                tpl.Local = true
        }
 
                tpl.Local = true
        }
 
-       // Set transaction reference data if applicable.
-       if len(b.referenceData) > 0 {
-               tx.ReferenceData = b.referenceData
-       }
-
        // Add all the built outputs.
        tx.Outputs = append(tx.Outputs, b.outputs...)
 
        // Add all the built outputs.
        tx.Outputs = append(tx.Outputs, b.outputs...)
 
index 62ddf4c..bdb2251 100644 (file)
@@ -35,7 +35,6 @@ func (o outputIDConstraint) code() []byte {
 // given data.
 type refdataConstraint struct {
        data []byte
 // given data.
 type refdataConstraint struct {
        data []byte
-       tx   bool
 }
 
 func (r refdataConstraint) code() []byte {
 }
 
 func (r refdataConstraint) code() []byte {
@@ -43,11 +42,7 @@ func (r refdataConstraint) code() []byte {
        sha3pool.Sum256(h[:], r.data)
        builder := vmutil.NewBuilder()
        builder.AddData(h[:])
        sha3pool.Sum256(h[:], r.data)
        builder := vmutil.NewBuilder()
        builder.AddData(h[:])
-       if r.tx {
-               builder.AddOp(vm.OP_TXDATA)
-       } else {
-               builder.AddOp(vm.OP_ENTRYDATA)
-       }
+       builder.AddOp(vm.OP_ENTRYDATA)
        builder.AddOp(vm.OP_EQUAL)
        prog, _ := builder.Build() // error is impossible
        return prog
        builder.AddOp(vm.OP_EQUAL)
        prog, _ := builder.Build() // error is impossible
        return prog
index 5111f9c..cbebcf6 100755 (executable)
@@ -55,10 +55,7 @@ func buildSigProgram(tpl *Template, index uint32) ([]byte, error) {
        // unconditional. Rationale: no one should be able to change "my"
        // reference data; anyone should be able to set tx refdata but, once
        // set, it should be immutable.
        // unconditional. Rationale: no one should be able to change "my"
        // reference data; anyone should be able to set tx refdata but, once
        // set, it should be immutable.
-       if len(tpl.Transaction.ReferenceData) > 0 {
-               constraints = append(constraints, refdataConstraint{tpl.Transaction.ReferenceData, true})
-       }
-       constraints = append(constraints, refdataConstraint{tpl.Transaction.Inputs[index].ReferenceData, false})
+       constraints = append(constraints, refdataConstraint{tpl.Transaction.Inputs[index].ReferenceData})
 
        for i, out := range tpl.Transaction.Outputs {
                c := &payConstraint{
 
        for i, out := range tpl.Transaction.Outputs {
                c := &payConstraint{
index 21eea8f..b6d86ef 100755 (executable)
@@ -51,7 +51,6 @@ func TestBuild(t *testing.T) {
        actions := []Action{
                newControlProgramAction(bc.AssetAmount{AssetId: &assetID2, Amount: 6}, []byte("dest")),
                testAction(bc.AssetAmount{AssetId: &assetID1, Amount: 5}),
        actions := []Action{
                newControlProgramAction(bc.AssetAmount{AssetId: &assetID2, Amount: 6}, []byte("dest")),
                testAction(bc.AssetAmount{AssetId: &assetID1, Amount: 5}),
-               &setTxRefDataAction{Data: []byte("xyz")},
        }
        expiryTime := time.Now().Add(time.Minute)
        got, err := Build(ctx, nil, actions, expiryTime)
        }
        expiryTime := time.Now().Add(time.Minute)
        got, err := Build(ctx, nil, actions, expiryTime)
@@ -62,7 +61,7 @@ func TestBuild(t *testing.T) {
        want := &Template{
                Transaction: legacy.NewTx(legacy.TxData{
                        Version:        1,
        want := &Template{
                Transaction: legacy.NewTx(legacy.TxData{
                        Version:        1,
-                       SerializedSize: 410,
+                       SerializedSize: 402,
                        Inputs: []*legacy.TxInput{
                                legacy.NewSpendInput(nil, bc.NewHash([32]byte{0xff}), assetID1, 5, 0, nil, bc.Hash{}, nil),
                        },
                        Inputs: []*legacy.TxInput{
                                legacy.NewSpendInput(nil, bc.NewHash([32]byte{0xff}), assetID1, 5, 0, nil, bc.Hash{}, nil),
                        },
@@ -70,7 +69,6 @@ func TestBuild(t *testing.T) {
                                legacy.NewTxOutput(assetID2, 6, []byte("dest"), nil),
                                legacy.NewTxOutput(assetID1, 5, []byte("change"), nil),
                        },
                                legacy.NewTxOutput(assetID2, 6, []byte("dest"), nil),
                                legacy.NewTxOutput(assetID1, 5, []byte("change"), nil),
                        },
-                       ReferenceData: []byte("xyz"),
                }),
                SigningInstructions: []*SigningInstruction{{
                        WitnessComponents: []witnessComponent{},
                }),
                SigningInstructions: []*SigningInstruction{{
                        WitnessComponents: []witnessComponent{},
@@ -84,20 +82,6 @@ func TestBuild(t *testing.T) {
        if !testutil.DeepEqual(got.SigningInstructions, want.SigningInstructions) {
                t.Errorf("got signing instructions:\n\t%#v\nwant signing instructions:\n\t%#v", got.SigningInstructions, want.SigningInstructions)
        }
        if !testutil.DeepEqual(got.SigningInstructions, want.SigningInstructions) {
                t.Errorf("got signing instructions:\n\t%#v\nwant signing instructions:\n\t%#v", got.SigningInstructions, want.SigningInstructions)
        }
-
-       // setting tx refdata twice should fail
-       actions = append(actions, &setTxRefDataAction{Data: []byte("lmnop")})
-       _, err = Build(ctx, nil, actions, expiryTime)
-       if errors.Root(err) != ErrAction {
-               t.Errorf("got error %#v, want ErrAction", err)
-       }
-       errs := errors.Data(err)["actions"].([]error)
-       if len(errs) != 1 {
-               t.Errorf("got error %v action errors, want 1", len(errs))
-       }
-       if errors.Root(errs[0]) != ErrBadRefData {
-               t.Errorf("got error %v in action error, want ErrBadRefData", errs[0])
-       }
 }
 
 func TestSignatureWitnessMaterialize(t *testing.T) {
 }
 
 func TestSignatureWitnessMaterialize(t *testing.T) {
index e29610b..e78549a 100755 (executable)
@@ -185,10 +185,6 @@ func buildAnnotatedTransaction(orig *legacy.Tx, b *legacy.Block, statusFail bool
                Outputs:                make([]*query.AnnotatedOutput, 0, len(orig.Outputs)),
                StatusFail:             statusFail,
        }
                Outputs:                make([]*query.AnnotatedOutput, 0, len(orig.Outputs)),
                StatusFail:             statusFail,
        }
-       if isValidJSON(orig.ReferenceData) {
-               referenceData := chainjson.HexBytes(orig.ReferenceData)
-               tx.ReferenceData = &referenceData
-       }
        for i := range orig.Inputs {
                tx.Inputs = append(tx.Inputs, buildAnnotatedInput(orig, uint32(i)))
        }
        for i := range orig.Inputs {
                tx.Inputs = append(tx.Inputs, buildAnnotatedInput(orig, uint32(i)))
        }
index 9d430c1..f02445b 100755 (executable)
@@ -80,7 +80,7 @@ func TestWalletUpdate(t *testing.T) {
        block := mockSingleBlock(tx)
 
        txStatus := bc.NewTransactionStatus()
        block := mockSingleBlock(tx)
 
        txStatus := bc.NewTransactionStatus()
-       store.SaveBlock(block, txStatus)
+       store.SaveBlock(block, txStatus, consensus.InitialSeed)
 
        err = w.attachBlock(block)
        if err != nil {
 
        err = w.attachBlock(block)
        if err != nil {
@@ -118,8 +118,12 @@ func TestExportAndImportPrivKey(t *testing.T) {
 
        genesisBlock := cfg.GenerateGenesisBlock()
 
 
        genesisBlock := cfg.GenerateGenesisBlock()
 
-       chain.SaveBlock(genesisBlock)
-       chain.ConnectBlock(genesisBlock)
+       if err = chain.SaveBlock(genesisBlock); err != nil {
+               t.Fatal(err)
+       }
+       if err = chain.ConnectBlock(genesisBlock); err != nil {
+               t.Fatal(err)
+       }
 
        acntManager := account.NewManager(testDB, chain)
        reg := asset.NewRegistry(testDB, chain)
 
        acntManager := account.NewManager(testDB, chain)
        reg := asset.NewRegistry(testDB, chain)
index c260bf5..33c409f 100644 (file)
@@ -47,7 +47,7 @@ func GenerateGenesisBlock() *legacy.Block {
                BlockHeader: legacy.BlockHeader{
                        Version:   1,
                        Height:    0,
                BlockHeader: legacy.BlockHeader{
                        Version:   1,
                        Height:    0,
-                       Nonce:     4216077,
+                       Nonce:     4216080,
                        Timestamp: 1516788453,
                        BlockCommitment: legacy.BlockCommitment{
                                TransactionsMerkleRoot: merkleRoot,
                        Timestamp: 1516788453,
                        BlockCommitment: legacy.BlockCommitment{
                                TransactionsMerkleRoot: merkleRoot,
index db342b7..f3e9ab0 100644 (file)
@@ -357,8 +357,7 @@ type TxHeader struct {
        SerializedSize uint64  `protobuf:"varint,2,opt,name=serialized_size,json=serializedSize" json:"serialized_size,omitempty"`
        TimeRange      uint64  `protobuf:"varint,3,opt,name=time_range,json=timeRange" json:"time_range,omitempty"`
        ResultIds      []*Hash `protobuf:"bytes,4,rep,name=result_ids,json=resultIds" json:"result_ids,omitempty"`
        SerializedSize uint64  `protobuf:"varint,2,opt,name=serialized_size,json=serializedSize" json:"serialized_size,omitempty"`
        TimeRange      uint64  `protobuf:"varint,3,opt,name=time_range,json=timeRange" json:"time_range,omitempty"`
        ResultIds      []*Hash `protobuf:"bytes,4,rep,name=result_ids,json=resultIds" json:"result_ids,omitempty"`
-       Data           *Hash   `protobuf:"bytes,5,opt,name=data" json:"data,omitempty"`
-       ExtHash        *Hash   `protobuf:"bytes,6,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
+       ExtHash        *Hash   `protobuf:"bytes,5,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
 }
 
 func (m *TxHeader) Reset()                    { *m = TxHeader{} }
 }
 
 func (m *TxHeader) Reset()                    { *m = TxHeader{} }
@@ -394,13 +393,6 @@ func (m *TxHeader) GetResultIds() []*Hash {
        return nil
 }
 
        return nil
 }
 
-func (m *TxHeader) GetData() *Hash {
-       if m != nil {
-               return m.Data
-       }
-       return nil
-}
-
 func (m *TxHeader) GetExtHash() *Hash {
        if m != nil {
                return m.ExtHash
 func (m *TxHeader) GetExtHash() *Hash {
        if m != nil {
                return m.ExtHash
@@ -791,67 +783,66 @@ func init() {
 func init() { proto.RegisterFile("bc.proto", fileDescriptor0) }
 
 var fileDescriptor0 = []byte{
 func init() { proto.RegisterFile("bc.proto", fileDescriptor0) }
 
 var fileDescriptor0 = []byte{
-       // 983 bytes of a gzipped FileDescriptorProto
+       // 975 bytes of a gzipped FileDescriptorProto
        0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
        0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
-       0x14, 0xd7, 0xda, 0x6b, 0xef, 0xfa, 0x25, 0xc4, 0xc9, 0x24, 0x2d, 0xab, 0xaa, 0x48, 0xd1, 0xa2,
-       0x90, 0xa2, 0x4a, 0x51, 0x9a, 0x14, 0xc4, 0x81, 0x03, 0x81, 0x00, 0xf5, 0x21, 0x80, 0x26, 0x55,
-       0xaf, 0xab, 0xf1, 0xee, 0x34, 0x1e, 0x61, 0xef, 0x98, 0x99, 0x59, 0x13, 0xf2, 0x31, 0xb8, 0xf2,
-       0x2d, 0x38, 0x72, 0xee, 0x87, 0xe0, 0x73, 0x70, 0xe6, 0x80, 0xe6, 0xed, 0xac, 0xbd, 0xfe, 0xd7,
-       0x24, 0x2a, 0xbd, 0xed, 0xfb, 0xb3, 0xef, 0xcf, 0xef, 0xbd, 0xdf, 0xcc, 0x40, 0xd8, 0x4f, 0x8f,
-       0xc6, 0x4a, 0x1a, 0x49, 0x1a, 0xfd, 0x34, 0xfe, 0x0e, 0xfc, 0x17, 0x4c, 0x0f, 0xc8, 0x16, 0x34,
-       0x26, 0xc7, 0x91, 0xb7, 0xef, 0x3d, 0x69, 0xd3, 0xc6, 0xe4, 0x18, 0xe5, 0x67, 0x51, 0xc3, 0xc9,
-       0xcf, 0x50, 0x3e, 0x89, 0x9a, 0x4e, 0x3e, 0x41, 0xf9, 0x34, 0xf2, 0x9d, 0x7c, 0x1a, 0x7f, 0x09,
-       0xc1, 0x4f, 0x4a, 0x5e, 0x29, 0x36, 0x22, 0x1f, 0x01, 0x4c, 0x46, 0xc9, 0x84, 0x2b, 0x2d, 0x64,
-       0x8e, 0x21, 0x7d, 0xda, 0x99, 0x8c, 0x5e, 0x95, 0x0a, 0x42, 0xc0, 0x4f, 0x65, 0xc6, 0x31, 0xf6,
-       0x26, 0xc5, 0xef, 0xb8, 0x07, 0xc1, 0x99, 0xd6, 0xdc, 0xf4, 0xce, 0xdf, 0xb9, 0x90, 0x0b, 0xd8,
-       0xc0, 0x50, 0x67, 0x23, 0x59, 0xe4, 0x86, 0x7c, 0x02, 0x21, 0xb3, 0x62, 0x22, 0x32, 0x0c, 0xba,
-       0x71, 0xb2, 0x71, 0xd4, 0x4f, 0x8f, 0x5c, 0x36, 0x1a, 0xa0, 0xb1, 0x97, 0x91, 0x87, 0xd0, 0x66,
-       0xf8, 0x07, 0xa6, 0xf2, 0xa9, 0x93, 0xe2, 0x3f, 0x3c, 0xe8, 0xa2, 0xf3, 0x39, 0x7f, 0x2d, 0x72,
-       0x61, 0x6c, 0x07, 0x27, 0xb0, 0x8d, 0x9f, 0x6c, 0x98, 0xf4, 0x87, 0x32, 0xfd, 0x79, 0x16, 0x3b,
-       0xb4, 0xb1, 0x2d, 0x9e, 0x74, 0xcb, 0x79, 0x7c, 0x6d, 0x1d, 0x7a, 0x19, 0xf9, 0x1c, 0xb6, 0x85,
-       0xd6, 0x05, 0xcb, 0x53, 0x9e, 0x8c, 0x4b, 0xa0, 0x30, 0x93, 0xab, 0xc7, 0x61, 0x47, 0xbb, 0x95,
-       0x53, 0x05, 0xe6, 0x63, 0xf0, 0x33, 0x66, 0x18, 0x36, 0x5c, 0x8f, 0x8f, 0xda, 0x78, 0x08, 0x1b,
-       0xaf, 0xd8, 0xb0, 0xe0, 0x97, 0xb2, 0x50, 0x29, 0x27, 0x8f, 0xa0, 0xa9, 0xf8, 0xeb, 0xa5, 0x5a,
-       0xac, 0x92, 0x1c, 0x40, 0x6b, 0x62, 0x5d, 0x5d, 0xd6, 0xee, 0x14, 0x85, 0x12, 0x28, 0x5a, 0x5a,
-       0xc9, 0x23, 0x08, 0xc7, 0x52, 0x63, 0x9f, 0x98, 0xd3, 0xa7, 0x53, 0x39, 0xfe, 0x05, 0xb6, 0x31,
-       0xdb, 0x39, 0xd7, 0x46, 0xe4, 0x0c, 0xb1, 0x78, 0xcf, 0x29, 0xff, 0x6d, 0xc0, 0x06, 0x42, 0xf8,
-       0x82, 0xb3, 0x8c, 0x2b, 0x12, 0x41, 0x30, 0xbf, 0x58, 0x95, 0x68, 0x07, 0x38, 0xe0, 0xe2, 0x6a,
-       0x30, 0x1d, 0x60, 0x29, 0x91, 0xe7, 0xb0, 0x33, 0x56, 0x7c, 0x22, 0x64, 0xa1, 0x67, 0xd3, 0x5a,
-       0x44, 0xb3, 0x5b, 0xb9, 0x54, 0xe3, 0x7a, 0x0c, 0x1d, 0x23, 0x46, 0x5c, 0x1b, 0x36, 0x1a, 0xe3,
-       0x72, 0xf9, 0x74, 0xa6, 0x20, 0x9f, 0xc1, 0x8e, 0x51, 0x2c, 0xd7, 0x2c, 0xb5, 0x45, 0xea, 0x44,
-       0x49, 0x69, 0xa2, 0xd6, 0x42, 0xcc, 0xed, 0xba, 0x0b, 0x95, 0xd2, 0x90, 0xaf, 0xe0, 0xc3, 0x9a,
-       0x2e, 0xd1, 0x86, 0x99, 0x42, 0x27, 0x03, 0xa6, 0x07, 0x51, 0x7b, 0xe1, 0xe7, 0x07, 0x35, 0xc7,
-       0x4b, 0xf4, 0x43, 0x96, 0xee, 0x41, 0x2b, 0x97, 0x79, 0xca, 0xa3, 0x00, 0x4b, 0x2a, 0x05, 0xcb,
-       0xa8, 0xbe, 0x30, 0x3a, 0x0a, 0x51, 0x89, 0xdf, 0xe4, 0x1c, 0xc8, 0x72, 0xae, 0xa8, 0x83, 0x69,
-       0x1e, 0xd8, 0x34, 0x2f, 0x17, 0x13, 0xd0, 0x9d, 0xa5, 0x9c, 0xf1, 0xdf, 0x1e, 0x84, 0x2f, 0xaf,
-       0x6f, 0xc5, 0xfe, 0x10, 0xba, 0x9a, 0x2b, 0xc1, 0x86, 0xe2, 0x86, 0x67, 0x89, 0x16, 0x37, 0xdc,
-       0x0d, 0x61, 0x6b, 0xa6, 0xbe, 0x14, 0x37, 0xdc, 0x1e, 0x0d, 0x16, 0xc5, 0x44, 0xb1, 0xfc, 0x8a,
-       0xbb, 0x61, 0x23, 0xae, 0xd4, 0x2a, 0xc8, 0x21, 0x80, 0xe2, 0xba, 0x18, 0x5a, 0xb6, 0xea, 0xc8,
-       0xdf, 0x6f, 0xce, 0x61, 0xd2, 0x29, 0x6d, 0xbd, 0x4c, 0x4f, 0x59, 0xd1, 0x5a, 0xc5, 0x0a, 0xf2,
-       0x31, 0x84, 0xfc, 0xda, 0xac, 0x06, 0x36, 0xe0, 0xd7, 0xc6, 0x7e, 0xc4, 0x4f, 0x61, 0x67, 0x09,
-       0x02, 0xbb, 0x44, 0x7d, 0x61, 0x46, 0x6c, 0x8c, 0x1d, 0x6e, 0x52, 0x27, 0xc5, 0xff, 0x78, 0xd0,
-       0xbc, 0x28, 0xae, 0xc9, 0xa7, 0x10, 0x68, 0xa4, 0x9a, 0x8e, 0x3c, 0xac, 0x0e, 0x77, 0xba, 0x46,
-       0x41, 0x5a, 0xd9, 0xc9, 0x01, 0x04, 0x6f, 0xe1, 0x79, 0x65, 0x9b, 0xab, 0xb5, 0xb9, 0xa6, 0x56,
-       0xf2, 0x3d, 0xec, 0xfd, 0x2a, 0x4c, 0xce, 0xb5, 0x4e, 0xb2, 0x19, 0xf7, 0x2a, 0x84, 0xf6, 0xa6,
-       0x35, 0xd4, 0x88, 0x49, 0x77, 0xdd, 0x1f, 0x35, 0x9d, 0x26, 0x4f, 0x61, 0xa7, 0x0a, 0xc4, 0xd4,
-       0x55, 0x31, 0xe2, 0xb9, 0xd1, 0x51, 0x6b, 0xbf, 0xf9, 0x64, 0x93, 0x6e, 0x3b, 0xc3, 0x59, 0xa5,
-       0x8f, 0xff, 0xf2, 0xa0, 0xf5, 0x03, 0x2e, 0x58, 0xad, 0x17, 0xef, 0x8e, 0xbd, 0x34, 0xd6, 0xf5,
-       0xb2, 0xb2, 0x84, 0xe6, 0xea, 0x12, 0xc8, 0x17, 0xb0, 0x3b, 0x75, 0xce, 0xd3, 0x81, 0x54, 0x3c,
-       0xb3, 0xf4, 0xf5, 0x17, 0x82, 0x57, 0x11, 0xcf, 0x9c, 0x4f, 0x2f, 0x8b, 0x25, 0x84, 0xdf, 0x48,
-       0x91, 0xf7, 0x99, 0xe6, 0xe4, 0xdb, 0x59, 0x94, 0x1a, 0x7c, 0xae, 0x95, 0xd5, 0xe8, 0x91, 0x65,
-       0xf4, 0xec, 0x99, 0xc0, 0x54, 0x5f, 0x18, 0xc5, 0xd4, 0x6f, 0xee, 0xf6, 0x9a, 0x29, 0xe2, 0x37,
-       0x1e, 0xb4, 0x7f, 0x2c, 0xcc, 0xb8, 0x30, 0xe4, 0x10, 0xda, 0xe5, 0x16, 0xb8, 0x14, 0x4b, 0x4b,
-       0xe2, 0xcc, 0xe4, 0x39, 0x74, 0x53, 0x99, 0x1b, 0x25, 0x87, 0x6f, 0xbb, 0x13, 0xb6, 0x9c, 0xcf,
-       0x9d, 0xae, 0x84, 0xb9, 0x21, 0xf8, 0xeb, 0x86, 0x10, 0x41, 0x20, 0x55, 0x26, 0x72, 0x36, 0x44,
-       0x0a, 0xf9, 0xb4, 0x12, 0xe3, 0xdf, 0x3d, 0x00, 0xca, 0x8d, 0x50, 0xdc, 0x4e, 0xe0, 0xee, 0xad,
-       0x54, 0x45, 0x35, 0x6e, 0x2d, 0xaa, 0x79, 0x87, 0xa2, 0xfc, 0xf9, 0xa2, 0xfe, 0x6c, 0x42, 0xd8,
-       0x73, 0x17, 0x23, 0x39, 0x80, 0x4e, 0xb9, 0x0b, 0xab, 0xae, 0xdd, 0xb0, 0x34, 0xf5, 0xb2, 0xbb,
-       0x5e, 0x3e, 0xff, 0x03, 0x98, 0x6b, 0xd6, 0xab, 0x75, 0xcf, 0xf5, 0xba, 0x80, 0x68, 0xba, 0xeb,
-       0xf8, 0x62, 0xc9, 0xa6, 0x2f, 0x0e, 0x77, 0x8a, 0xed, 0x4e, 0x7b, 0x98, 0x3d, 0x46, 0xe8, 0xc3,
-       0x6a, 0xf7, 0x17, 0x1e, 0x29, 0x2b, 0x79, 0x16, 0xdc, 0x8f, 0x67, 0xe1, 0xad, 0x3c, 0xab, 0x0f,
-       0xad, 0x33, 0x3f, 0xb4, 0x37, 0x0d, 0x68, 0x5d, 0x8e, 0x79, 0x9e, 0x91, 0x63, 0xe8, 0xea, 0x31,
-       0xcf, 0x4d, 0x22, 0x91, 0x1f, 0xab, 0xe6, 0xf6, 0x01, 0x3a, 0x94, 0xfc, 0xc1, 0xeb, 0xf7, 0x9d,
-       0xb7, 0x69, 0xcd, 0x54, 0xfc, 0x7b, 0x4e, 0xe5, 0x3e, 0x27, 0xe6, 0x3a, 0x18, 0xdb, 0xf7, 0x82,
-       0x31, 0x98, 0x83, 0xb1, 0xdf, 0xc6, 0xb7, 0xfa, 0xe9, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc,
-       0x0c, 0xd7, 0x36, 0xb7, 0x0b, 0x00, 0x00,
+       0x14, 0x97, 0xed, 0xb5, 0x77, 0xfd, 0x52, 0xe2, 0x78, 0x92, 0x96, 0x55, 0x55, 0xa4, 0x68, 0x51,
+       0x48, 0x51, 0xa5, 0x28, 0x4d, 0x0a, 0xe2, 0xc0, 0x81, 0x40, 0x80, 0xfa, 0x10, 0x40, 0x93, 0xaa,
+       0xd7, 0xd5, 0x78, 0x77, 0x1a, 0x8f, 0xb0, 0x77, 0xcc, 0xcc, 0xac, 0x09, 0xf9, 0x18, 0x5c, 0xf9,
+       0x16, 0x1c, 0x39, 0xf7, 0x13, 0x71, 0xe6, 0x80, 0xe6, 0xed, 0xac, 0xbd, 0xfe, 0xd7, 0xd8, 0x2a,
+       0xdc, 0xf6, 0xfd, 0xd9, 0xf7, 0xe7, 0xf7, 0xde, 0x6f, 0x66, 0x20, 0xe8, 0x27, 0x27, 0x63, 0x25,
+       0x8d, 0x24, 0xf5, 0x7e, 0x12, 0x7d, 0x07, 0xde, 0x4b, 0xa6, 0x07, 0x64, 0x17, 0xea, 0x93, 0xd3,
+       0xb0, 0x76, 0x58, 0x7b, 0xda, 0xa2, 0xf5, 0xc9, 0x29, 0xca, 0xcf, 0xc3, 0xba, 0x93, 0x9f, 0xa3,
+       0x7c, 0x16, 0x36, 0x9c, 0x7c, 0x86, 0xf2, 0x79, 0xe8, 0x39, 0xf9, 0x3c, 0xfa, 0x12, 0xfc, 0x9f,
+       0x94, 0xbc, 0x51, 0x6c, 0x44, 0x3e, 0x02, 0x98, 0x8c, 0xe2, 0x09, 0x57, 0x5a, 0xc8, 0x0c, 0x43,
+       0x7a, 0xb4, 0x3d, 0x19, 0xbd, 0x2e, 0x14, 0x84, 0x80, 0x97, 0xc8, 0x94, 0x63, 0xec, 0x07, 0x14,
+       0xbf, 0xa3, 0x1e, 0xf8, 0x17, 0x5a, 0x73, 0xd3, 0xbb, 0x7c, 0xef, 0x42, 0xae, 0x60, 0x07, 0x43,
+       0x5d, 0x8c, 0x64, 0x9e, 0x19, 0xf2, 0x09, 0x04, 0xcc, 0x8a, 0xb1, 0x48, 0x31, 0xe8, 0xce, 0xd9,
+       0xce, 0x49, 0x3f, 0x39, 0x71, 0xd9, 0xa8, 0x8f, 0xc6, 0x5e, 0x4a, 0x1e, 0x41, 0x8b, 0xe1, 0x1f,
+       0x98, 0xca, 0xa3, 0x4e, 0x8a, 0xfe, 0xa8, 0x41, 0x07, 0x9d, 0x2f, 0xf9, 0x1b, 0x91, 0x09, 0x63,
+       0x3b, 0x38, 0x83, 0x3d, 0xfc, 0x64, 0xc3, 0xb8, 0x3f, 0x94, 0xc9, 0xcf, 0xb3, 0xd8, 0x81, 0x8d,
+       0x6d, 0xf1, 0xa4, 0xbb, 0xce, 0xe3, 0x6b, 0xeb, 0xd0, 0x4b, 0xc9, 0xe7, 0xb0, 0x27, 0xb4, 0xce,
+       0x59, 0x96, 0xf0, 0x78, 0x5c, 0x00, 0x85, 0x99, 0x5c, 0x3d, 0x0e, 0x3b, 0xda, 0x29, 0x9d, 0x4a,
+       0x30, 0x9f, 0x80, 0x97, 0x32, 0xc3, 0xb0, 0xe1, 0x6a, 0x7c, 0xd4, 0x46, 0x43, 0xd8, 0x79, 0xcd,
+       0x86, 0x39, 0xbf, 0x96, 0xb9, 0x4a, 0x38, 0x79, 0x0c, 0x0d, 0xc5, 0xdf, 0x2c, 0xd5, 0x62, 0x95,
+       0xe4, 0x08, 0x9a, 0x13, 0xeb, 0xea, 0xb2, 0x76, 0xa6, 0x28, 0x14, 0x40, 0xd1, 0xc2, 0x4a, 0x1e,
+       0x43, 0x30, 0x96, 0x1a, 0xfb, 0xc4, 0x9c, 0x1e, 0x9d, 0xca, 0xd1, 0x2f, 0xb0, 0x87, 0xd9, 0x2e,
+       0xb9, 0x36, 0x22, 0x63, 0x88, 0xc5, 0xff, 0x9c, 0xf2, 0x9f, 0x3a, 0xec, 0x20, 0x84, 0x2f, 0x39,
+       0x4b, 0xb9, 0x22, 0x21, 0xf8, 0xf3, 0x8b, 0x55, 0x8a, 0x76, 0x80, 0x03, 0x2e, 0x6e, 0x06, 0xd3,
+       0x01, 0x16, 0x12, 0x79, 0x01, 0xdd, 0xb1, 0xe2, 0x13, 0x21, 0x73, 0x3d, 0x9b, 0xd6, 0x22, 0x9a,
+       0x9d, 0xd2, 0xa5, 0x1c, 0xd7, 0x13, 0x68, 0x1b, 0x31, 0xe2, 0xda, 0xb0, 0xd1, 0x18, 0x97, 0xcb,
+       0xa3, 0x33, 0x05, 0xf9, 0x0c, 0xba, 0x46, 0xb1, 0x4c, 0xb3, 0xc4, 0x16, 0xa9, 0x63, 0x25, 0xa5,
+       0x09, 0x9b, 0x0b, 0x31, 0xf7, 0xaa, 0x2e, 0x54, 0x4a, 0x43, 0xbe, 0x82, 0x0f, 0x2b, 0xba, 0x58,
+       0x1b, 0x66, 0x72, 0x1d, 0x0f, 0x98, 0x1e, 0x84, 0xad, 0x85, 0x9f, 0x1f, 0x56, 0x1c, 0xaf, 0xd1,
+       0x0f, 0x59, 0x7a, 0x00, 0xcd, 0x4c, 0x66, 0x09, 0x0f, 0x7d, 0x2c, 0xa9, 0x10, 0x2c, 0xa3, 0xfa,
+       0xc2, 0xe8, 0x30, 0x40, 0x25, 0x7e, 0x93, 0x4b, 0x20, 0xcb, 0xb9, 0xc2, 0x36, 0xa6, 0x79, 0x68,
+       0xd3, 0xbc, 0x5a, 0x4c, 0x40, 0xbb, 0x4b, 0x39, 0xa3, 0xbf, 0x6a, 0x10, 0xbc, 0xba, 0xbd, 0x17,
+       0xfb, 0x63, 0xe8, 0x68, 0xae, 0x04, 0x1b, 0x8a, 0x3b, 0x9e, 0xc6, 0x5a, 0xdc, 0x71, 0x37, 0x84,
+       0xdd, 0x99, 0xfa, 0x5a, 0xdc, 0x71, 0x7b, 0x34, 0x58, 0x14, 0x63, 0xc5, 0xb2, 0x1b, 0xee, 0x86,
+       0x8d, 0xb8, 0x52, 0xab, 0x20, 0xc7, 0x00, 0x8a, 0xeb, 0x7c, 0x68, 0xd9, 0xaa, 0x43, 0xef, 0xb0,
+       0x31, 0x87, 0x49, 0xbb, 0xb0, 0xf5, 0x52, 0x4d, 0x3e, 0x86, 0x80, 0xdf, 0x9a, 0x02, 0xba, 0x45,
+       0xdc, 0x7d, 0x7e, 0x6b, 0xec, 0x47, 0xf4, 0x0c, 0xba, 0x4b, 0x4d, 0xda, 0x35, 0xe9, 0x0b, 0x33,
+       0x62, 0x63, 0xec, 0xe1, 0x01, 0x75, 0x52, 0xf4, 0x77, 0x0d, 0x1a, 0x57, 0xf9, 0x2d, 0xf9, 0x14,
+       0x7c, 0x8d, 0x64, 0xd2, 0x61, 0x0d, 0xf3, 0xe3, 0xd6, 0x56, 0x48, 0x46, 0x4b, 0x3b, 0x39, 0x02,
+       0xff, 0x1d, 0x4c, 0x2e, 0x6d, 0x73, 0xb5, 0x36, 0xd6, 0xd4, 0x4a, 0xbe, 0x87, 0x83, 0x5f, 0x85,
+       0xc9, 0xb8, 0xd6, 0x71, 0x3a, 0x63, 0x57, 0x89, 0xc1, 0xc1, 0xb4, 0x86, 0x0a, 0xf5, 0xe8, 0xbe,
+       0xfb, 0xa3, 0xa2, 0xd3, 0xe4, 0x19, 0x74, 0xcb, 0x40, 0x4c, 0xdd, 0xe4, 0x23, 0x9e, 0x19, 0x1d,
+       0x36, 0x0f, 0x1b, 0x4f, 0x1f, 0xd0, 0x3d, 0x67, 0xb8, 0x28, 0xf5, 0x76, 0xbc, 0xcd, 0x1f, 0x70,
+       0x85, 0x2a, 0xbd, 0xd4, 0x36, 0xec, 0xa5, 0xbe, 0xae, 0x97, 0x95, 0x25, 0x34, 0x56, 0x97, 0x40,
+       0xbe, 0x80, 0xfd, 0xa9, 0x73, 0x96, 0x0c, 0xa4, 0xe2, 0xa9, 0x25, 0xa8, 0xb7, 0x10, 0xbc, 0x8c,
+       0x78, 0xe1, 0x7c, 0x7a, 0x69, 0x24, 0x21, 0xf8, 0x46, 0x8a, 0xac, 0xcf, 0x34, 0x27, 0xdf, 0xce,
+       0xa2, 0x54, 0xe0, 0x73, 0xad, 0xac, 0x46, 0x8f, 0x2c, 0xa3, 0x67, 0x59, 0xcf, 0x54, 0x5f, 0x18,
+       0xc5, 0xd4, 0x6f, 0xee, 0x7e, 0x9a, 0x29, 0xa2, 0xb7, 0x35, 0x68, 0xfd, 0x98, 0x9b, 0x71, 0x6e,
+       0xc8, 0x31, 0xb4, 0x8a, 0x2d, 0x70, 0x29, 0x96, 0x96, 0xc4, 0x99, 0xc9, 0x0b, 0xe8, 0x24, 0x32,
+       0x33, 0x4a, 0x0e, 0xdf, 0x75, 0xea, 0xef, 0x3a, 0x9f, 0x8d, 0x0e, 0xfd, 0xb9, 0x21, 0x78, 0xeb,
+       0x86, 0x10, 0x82, 0x2f, 0x55, 0x2a, 0x32, 0x36, 0x44, 0x82, 0x78, 0xb4, 0x14, 0xa3, 0xdf, 0x6b,
+       0x00, 0x94, 0x1b, 0xa1, 0xb8, 0x9d, 0xc0, 0xe6, 0xad, 0x94, 0x45, 0xd5, 0xef, 0x2d, 0xaa, 0xb1,
+       0x41, 0x51, 0xde, 0x7c, 0x51, 0x7f, 0x36, 0x20, 0xe8, 0xb9, 0xab, 0x8f, 0x1c, 0x41, 0xbb, 0xd8,
+       0x85, 0x55, 0x17, 0x6b, 0x50, 0x98, 0x7a, 0xe9, 0xa6, 0xd7, 0xcb, 0x7f, 0x00, 0xe6, 0x9a, 0xf5,
+       0x6a, 0x6e, 0xb9, 0x5e, 0x57, 0x10, 0x4e, 0x77, 0x1d, 0xdf, 0x24, 0xe9, 0xf4, 0x4d, 0xe1, 0x2e,
+       0x80, 0xfd, 0x69, 0x0f, 0xb3, 0xe7, 0x06, 0x7d, 0x54, 0xee, 0xfe, 0xc2, 0x33, 0x64, 0x25, 0xcf,
+       0xfc, 0xed, 0x78, 0x16, 0xdc, 0xcb, 0xb3, 0xea, 0xd0, 0xda, 0xf3, 0x43, 0x7b, 0x5b, 0x87, 0xe6,
+       0xf5, 0x98, 0x67, 0x29, 0x39, 0x85, 0x8e, 0x1e, 0xf3, 0xcc, 0xc4, 0x12, 0xf9, 0xb1, 0x6a, 0x6e,
+       0x1f, 0xa0, 0x43, 0xc1, 0x1f, 0xbc, 0x60, 0xdf, 0x7b, 0x9b, 0xd6, 0x4c, 0xc5, 0xdb, 0x72, 0x2a,
+       0xdb, 0x9c, 0x98, 0xeb, 0x60, 0x6c, 0x6d, 0x05, 0xa3, 0x3f, 0x07, 0x63, 0xbf, 0x85, 0xaf, 0xf1,
+       0xf3, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xb2, 0xd8, 0x44, 0xdf, 0x99, 0x0b, 0x00, 0x00,
 }
 }
index 35ff765..3627031 100644 (file)
@@ -66,8 +66,7 @@ message TxHeader {
   uint64        serialized_size = 2;
   uint64        time_range      = 3;
   repeated Hash result_ids      = 4;
   uint64        serialized_size = 2;
   uint64        time_range      = 3;
   repeated Hash result_ids      = 4;
-  Hash          data            = 5;
-  Hash          ext_hash        = 6;
+  Hash          ext_hash        = 5;
 }
 
 message TransactionStatus {
 }
 
 message TransactionStatus {
index 547056c..9bc22ce 100644 (file)
@@ -11,7 +11,7 @@ func BenchmarkEntryID(b *testing.B) {
        entries := []Entry{
                NewIssuance(nil, &AssetAmount{}, &Hash{}, 0),
                m,
        entries := []Entry{
                NewIssuance(nil, &AssetAmount{}, &Hash{}, 0),
                m,
-               NewTxHeader(1, 1, 0, nil, &Hash{}),
+               NewTxHeader(1, 1, 0, nil),
                NewNonce(&Program{Code: []byte{1}, VmVersion: 1}),
                NewOutput(&ValueSource{}, &Program{Code: []byte{1}, VmVersion: 1}, &Hash{}, 0),
                NewRetirement(&ValueSource{}, &Hash{}, 1),
                NewNonce(&Program{Code: []byte{1}, VmVersion: 1}),
                NewOutput(&ValueSource{}, &Program{Code: []byte{1}, VmVersion: 1}, &Hash{}, 0),
                NewRetirement(&ValueSource{}, &Hash{}, 1),
index 7afe8f8..5281f0b 100644 (file)
@@ -23,7 +23,7 @@ func TestMarshalBlock(t *testing.T) {
                Transactions: []*Tx{
                        NewTx(TxData{
                                Version:        1,
                Transactions: []*Tx{
                        NewTx(TxData{
                                Version:        1,
-                               SerializedSize: uint64(46),
+                               SerializedSize: uint64(45),
                                Outputs: []*TxOutput{
                                        NewTxOutput(bc.AssetID{}, 1, nil, nil),
                                },
                                Outputs: []*TxOutput{
                                        NewTxOutput(bc.AssetID{}, 1, nil, nil),
                                },
@@ -62,8 +62,7 @@ func TestMarshalBlock(t *testing.T) {
                "01" + // tx 0, output 0 commitment vm version
                "00" + // tx 0, output 0 control program
                "00" + // tx 0, output 0 reference data
                "01" + // tx 0, output 0 commitment vm version
                "00" + // tx 0, output 0 control program
                "00" + // tx 0, output 0 reference data
-               "00" + // tx 0, output 0 output witness
-               "00\"") // tx 0 reference data
+               "00\"") // tx 0, output 0 output witness
 
        if !bytes.Equal(got, []byte(wantHex)) {
                t.Errorf("marshaled block bytes = %s want %s", got, []byte(wantHex))
 
        if !bytes.Equal(got, []byte(wantHex)) {
                t.Errorf("marshaled block bytes = %s want %s", got, []byte(wantHex))
@@ -159,7 +158,7 @@ func TestSmallBlock(t *testing.T) {
                "00" + // nonce
                "00" + // bits
                "01" + // num transactions
                "00" + // nonce
                "00" + // bits
                "01" + // num transactions
-               "07010000000000") // transaction
+               "070100000000") // transaction
        want, _ := hex.DecodeString(wantHex)
        if !bytes.Equal(got, want) {
                t.Errorf("small block bytes = %x want %x", got, want)
        want, _ := hex.DecodeString(wantHex)
        if !bytes.Equal(got, want) {
                t.Errorf("small block bytes = %x want %x", got, want)
index 91ab678..52eb4d5 100644 (file)
@@ -3,7 +3,7 @@ package legacy
 import "testing"
 
 func TestFuzzUnknownAssetVersion(t *testing.T) {
 import "testing"
 
 func TestFuzzUnknownAssetVersion(t *testing.T) {
-       const rawTx = `0701000001f1b72b0001012b00089def834ab929327f3f479177e2d8c293f2f7fc4f251db8547896c0eeafb984261a73767178584c246400b50150935a092ffad7ec9fbac4f4486db6c3b8cd5b9f51cf697248584dde286a722000012b766baa20627e83fdad13dd98436fa7cbdd1412d50ef65528edb7e2ed8f2675b2a0b209235151ad696c00c0030040b984261ad6e71876ec4c2464012b766baa209d44ee5b6ebf6c408772ead7713f1a66b9de7655ff452513487be1fb10de7d985151ad696c00c02a7b2274657374223a225175657279546573742e7465737442616c616e636551756572792e74657374227d`
+       const rawTx = `07010000000101270eac870dfde1e0feaa4fac6693dee38da2afe7f5cc83ce2b024f04a2400fd6e20a0104deadbeef027b7d00`
 
        var want Tx
        err := want.UnmarshalText([]byte(rawTx))
 
        var want Tx
        err := want.UnmarshalText([]byte(rawTx))
index 81b4581..bc805e2 100644 (file)
@@ -233,8 +233,7 @@ func mapTx(tx *TxData) (headerID bc.Hash, hdr *bc.TxHeader, entryMap map[bc.Hash
                mux.WitnessDestinations = append(mux.WitnessDestinations, dest)
        }
 
                mux.WitnessDestinations = append(mux.WitnessDestinations, dest)
        }
 
-       refdatahash := hashData(tx.ReferenceData)
-       h := bc.NewTxHeader(tx.Version, tx.SerializedSize, tx.TimeRange, resultIDs, &refdatahash)
+       h := bc.NewTxHeader(tx.Version, tx.SerializedSize, tx.TimeRange, resultIDs)
        headerID = addEntry(h)
 
        return headerID, h, entryMap
        headerID = addEntry(h)
 
        return headerID, h, entryMap
index 2c878eb..7316148 100644 (file)
@@ -92,8 +92,6 @@ type TxData struct {
 
        // The unconsumed suffix of the common witness extensible string
        CommonWitnessSuffix []byte
 
        // The unconsumed suffix of the common witness extensible string
        CommonWitnessSuffix []byte
-
-       ReferenceData []byte
 }
 
 // HasIssuance returns true if this transaction has an issuance input.
 }
 
 // HasIssuance returns true if this transaction has an issuance input.
@@ -170,8 +168,7 @@ func (tx *TxData) readFrom(r *blockchain.Reader) (err error) {
                tx.Outputs = append(tx.Outputs, to)
        }
 
                tx.Outputs = append(tx.Outputs, to)
        }
 
-       tx.ReferenceData, err = blockchain.ReadVarstr31(r)
-       return errors.Wrap(err, "reading transaction reference data")
+       return nil
 }
 
 // does not read the enclosing extensible string
 }
 
 // does not read the enclosing extensible string
@@ -231,7 +228,7 @@ func (tx *TxData) writeTo(w io.Writer, serflags byte) error {
                }
        }
 
                }
        }
 
-       return writeRefData(w, tx.ReferenceData, serflags)
+       return nil
 }
 
 // does not write the enclosing extensible string
 }
 
 // does not write the enclosing extensible string
index 981388c..17e1705 100644 (file)
@@ -16,7 +16,7 @@ import (
 )
 
 func TestTransactionTrailingGarbage(t *testing.T) {
 )
 
 func TestTransactionTrailingGarbage(t *testing.T) {
-       const validTxHex = `07010000000101270eac870dfde1e0feaa4fac6693dee38da2afe7f5cc83ce2b024f04a2400fd6e20a0104deadbeef027b7d0000`
+       const validTxHex = `07010000000101270eac870dfde1e0feaa4fac6693dee38da2afe7f5cc83ce2b024f04a2400fd6e20a0104deadbeef027b7d00`
 
        var validTx Tx
        err := validTx.UnmarshalText([]byte(validTxHex))
 
        var validTx Tx
        err := validTx.UnmarshalText([]byte(validTxHex))
@@ -36,7 +36,7 @@ func TestTransaction(t *testing.T) {
        issuanceScript := []byte{1}
        initialBlockHashHex := "03deff1d4319d67baa10a6d26c1fea9c3e8d30e33474efee1a610a9bb49d758d"
        initialBlockHash := mustDecodeHash(initialBlockHashHex)
        issuanceScript := []byte{1}
        initialBlockHashHex := "03deff1d4319d67baa10a6d26c1fea9c3e8d30e33474efee1a610a9bb49d758d"
        initialBlockHash := mustDecodeHash(initialBlockHashHex)
-
+       //
        assetID := bc.ComputeAssetID(issuanceScript, &initialBlockHash, 1, &bc.EmptyStringHash)
 
        cases := []struct {
        assetID := bc.ComputeAssetID(issuanceScript, &initialBlockHash, 1, &bc.EmptyStringHash)
 
        cases := []struct {
@@ -47,70 +47,36 @@ func TestTransaction(t *testing.T) {
                {
                        tx: NewTx(TxData{
                                Version:        1,
                {
                        tx: NewTx(TxData{
                                Version:        1,
-                               SerializedSize: uint64(7),
+                               SerializedSize: uint64(6),
                                Inputs:         nil,
                                Outputs:        nil,
                                Inputs:         nil,
                                Outputs:        nil,
-                               ReferenceData:  nil,
                        }),
                        hex: ("07" + // serflags
                                "01" + // transaction version
                                "00" + // tx maxtime
                                "00" + // common witness extensible string length
                                "00" + // inputs count
                        }),
                        hex: ("07" + // serflags
                                "01" + // transaction version
                                "00" + // tx maxtime
                                "00" + // common witness extensible string length
                                "00" + // inputs count
-                               "00" + // outputs count
-                               "00"), // reference data
-                       hash: mustDecodeHash("196ffe40c99e0c25bc2b7347db147e626a13132a8d404b92e270ec6e8df24234"),
+                               "00"), // outputs count
+                       hash: mustDecodeHash("d7b066ef9e03e9ccea87b6d6769c8d0477bf33554f5fcdee3d5d22fa1be2f2f5"),
                },
                {
                        tx: NewTx(TxData{
                                Version:        1,
                },
                {
                        tx: NewTx(TxData{
                                Version:        1,
-                               SerializedSize: uint64(159),
+                               SerializedSize: uint64(150),
                                Inputs: []*TxInput{
                                        NewIssuanceInput([]byte{10, 9, 8}, 1000000000000, []byte("input"), initialBlockHash, issuanceScript, [][]byte{[]byte{1, 2, 3}}, nil),
                                },
                                Outputs: []*TxOutput{
                                        NewTxOutput(bc.AssetID{}, 1000000000000, []byte{1}, []byte("output")),
                                },
                                Inputs: []*TxInput{
                                        NewIssuanceInput([]byte{10, 9, 8}, 1000000000000, []byte("input"), initialBlockHash, issuanceScript, [][]byte{[]byte{1, 2, 3}}, nil),
                                },
                                Outputs: []*TxOutput{
                                        NewTxOutput(bc.AssetID{}, 1000000000000, []byte{1}, []byte("output")),
                                },
-                               ReferenceData: []byte("issuance"),
                        }),
                        }),
-                       hex: ("07" + // serflags
-                               "01" + // transaction version
-                               "00" + // tx maxtime
-                               "00" + // common witness extensible string length
-                               "01" + // inputs count
-                               "01" + // input 0, asset version
-                               "2b" + // input 0, input commitment length prefix
-                               "00" + // input 0, input commitment, "issuance" type
-                               "03" + // input 0, input commitment, nonce length prefix
-                               "0a0908" + // input 0, input commitment, nonce
-                               assetID.String() + // input 0, input commitment, asset id
-                               "80a094a58d1d" + // input 0, input commitment, amount
-                               "05696e707574" + // input 0, reference data
-                               "29" + // input 0, issuance input witness length prefix
-                               initialBlockHashHex + // input 0, issuance input witness, initial block
-                               "00" + // input 0, issuance input witness, asset definition
-                               "01" + // input 0, issuance input witness, vm version
-                               "01" + // input 0, issuance input witness, issuance program length prefix
-                               "01" + // input 0, issuance input witness, issuance program
-                               "01" + // input 0, issuance input witness, arguments count
-                               "03" + // input 0, issuance input witness, argument 0 length prefix
-                               "010203" + // input 0, issuance input witness, argument 0
-                               "01" + // outputs count
-                               "01" + // output 0, asset version
-                               "29" + // output 0, output commitment length
-                               "0000000000000000000000000000000000000000000000000000000000000000" + // output 0, output commitment, asset id
-                               "80a094a58d1d" + // output 0, output commitment, amount
-                               "01" + // output 0, output commitment, vm version
-                               "0101" + // output 0, output commitment, control program
-                               "066f7574707574" + // output 0, reference data
-                               "00" + // output 0, output witness
-                               "0869737375616e6365"), // reference data
-                       hash: mustDecodeHash("7a9e4f4b87d8af099081d0dfec77fe33ccf288d586308d8a14a640b72ca474f8"),
+                       hex: ("0701000001012b00030a0908a9b2b6c5394888ab5396f583ae484b8459486b14268e2bef1b637440335eb6c180a094a58d1d05696e7075742903deff1d4319d67baa10a6d26c1fea9c3e8d30e33474efee1a610a9bb49d758d000101010103010203010129000000000000000000000000000000000000000000000000000000000000000080a094a58d1d010101066f757470757400"), // reference data
+                       hash: mustDecodeHash("7603c9dbd98381883f96b9b90d37cedab93879fe03591ceec6c7933e096fc158"),
                },
                {
                        tx: NewTx(TxData{
                                Version:        1,
                },
                {
                        tx: NewTx(TxData{
                                Version:        1,
-                               SerializedSize: uint64(227),
+                               SerializedSize: uint64(214),
                                Inputs: []*TxInput{
                                        NewSpendInput(nil, mustDecodeHash("dd385f6fe25d91d8c1bd0fa58951ad56b0c5229dcc01f61d9f9e8b9eb92d3292"), bc.AssetID{}, 1000000000000, 1, []byte{1}, bc.Hash{}, []byte("input")),
                                },
                                Inputs: []*TxInput{
                                        NewSpendInput(nil, mustDecodeHash("dd385f6fe25d91d8c1bd0fa58951ad56b0c5229dcc01f61d9f9e8b9eb92d3292"), bc.AssetID{}, 1000000000000, 1, []byte{1}, bc.Hash{}, []byte("input")),
                                },
@@ -118,46 +84,9 @@ func TestTransaction(t *testing.T) {
                                        NewTxOutput(assetID, 600000000000, []byte{1}, nil),
                                        NewTxOutput(assetID, 400000000000, []byte{2}, nil),
                                },
                                        NewTxOutput(assetID, 600000000000, []byte{1}, nil),
                                        NewTxOutput(assetID, 400000000000, []byte{2}, nil),
                                },
-                               ReferenceData: []byte("distribution"),
                        }),
                        }),
-                       hex: ("07" + // serflags
-                               "01" + // transaction version
-                               "00" + // tx maxtime
-                               "00" + // common witness extensible string length
-                               "01" + // inputs count
-                               "01" + // input 0, asset version
-                               "6c" + // input 0, input commitment length prefix
-                               "01" + // input 0, input commitment, "spend" type+
-                               "6a" + // input 0, spend input commitment, spend commitment length prefix
-                               "dd385f6fe25d91d8c1bd0fa58951ad56b0c5229dcc01f61d9f9e8b9eb92d3292" + // input 0, spend input commitment, spend commitment, source ID
-                               "0000000000000000000000000000000000000000000000000000000000000000" + // input 0, spend input commitment, spend commitment, asset id
-                               "80a094a58d1d" + // input 0, spend input commitment, spend commitment, amount
-                               "01" + // input 0, spend input commitment, spend commitment, source position
-                               "01" + // input 0, spend input commitment, spend commitment, vm version
-                               "0101" + // input 0, spend input commitment, spend commitment, control program
-                               "0000000000000000000000000000000000000000000000000000000000000000" + // input 0, spend input commitment, spend commitment, reference data hash
-                               "05696e707574" + // input 0, reference data
-                               "01" + // input 0, input witness length prefix
-                               "00" + // input 0, input witness, number of args
-                               "02" + // outputs count
-                               "01" + // output 0, asset version
-                               "29" + // output 0, output commitment length
-                               "a9b2b6c5394888ab5396f583ae484b8459486b14268e2bef1b637440335eb6c1" + // output 0, output commitment, asset id
-                               "80e0a596bb11" + // output 0, output commitment, amount
-                               "01" + // output 0, output commitment, vm version
-                               "0101" + // output 0, output commitment, control program
-                               "00" + // output 0, reference data
-                               "00" + // output 0, output witness
-                               "01" + // output 1, asset version
-                               "29" + // output 1, output commitment length
-                               "a9b2b6c5394888ab5396f583ae484b8459486b14268e2bef1b637440335eb6c1" + // output 1, output commitment, asset id
-                               "80c0ee8ed20b" + // output 1, output commitment, amount
-                               "01" + // output 1, vm version
-                               "0102" + // output 1, output commitment, control program
-                               "00" + // output 1, reference data
-                               "00" + // output 1, output witness
-                               "0c646973747269627574696f6e"), // reference data
-                       hash: mustDecodeHash("4074fc31692af33defcee32189eaa8cb6219db259883707009b048d7165812ca"),
+                       hex: ("0701000001016c016add385f6fe25d91d8c1bd0fa58951ad56b0c5229dcc01f61d9f9e8b9eb92d3292000000000000000000000000000000000000000000000000000000000000000080a094a58d1d01010101000000000000000000000000000000000000000000000000000000000000000005696e7075740100020129a9b2b6c5394888ab5396f583ae484b8459486b14268e2bef1b637440335eb6c180e0a596bb1101010100000129a9b2b6c5394888ab5396f583ae484b8459486b14268e2bef1b637440335eb6c180c0ee8ed20b0101020000"), // output 1, output witness
+                       hash: mustDecodeHash("e588d0e8ed6fe123550f84f327072be954d9cb023ae8cef7e74faca429f8f091"),
                },
        }
        for i, test := range cases {
                },
        }
        for i, test := range cases {
index 119a41b..8ca1d5f 100644 (file)
@@ -15,11 +15,11 @@ func TestTxHashes(t *testing.T) {
        }{
                {
                        txdata: &TxData{},
        }{
                {
                        txdata: &TxData{},
-                       hash:   mustDecodeHash("221ed254e69ffaefc0c52baff161392001f8c3ce5c120e4d2cba26eef0bf9500"),
+                       hash:   mustDecodeHash("e52b4bc1367e750d88953b78eeb4c8d352504133a04129f53c099cd03e500f22"),
                },
                {
                        txdata: sampleTx(),
                },
                {
                        txdata: sampleTx(),
-                       hash:   mustDecodeHash("0fd4368e2348690af748eb1b4d5a661dd7ee2cf3b6555ce788aea391d9c10718"), // todo: verify this value,
+                       hash:   mustDecodeHash("cee0721776e50e7788e8e727e3635856053a651eec4766f7b4c86c60547d2884"), // todo: verify this value,
                },
        }
 
                },
        }
 
@@ -62,6 +62,5 @@ func sampleTx() *TxData {
                        NewTxOutput(assetID, 600000000000, []byte{1}, nil),
                        NewTxOutput(assetID, 400000000000, []byte{2}, nil),
                },
                        NewTxOutput(assetID, 600000000000, []byte{1}, nil),
                        NewTxOutput(assetID, 400000000000, []byte{2}, nil),
                },
-               ReferenceData: []byte("distribution"),
        }
 }
        }
 }
index 7b1c72f..5d61bd0 100644 (file)
@@ -20,7 +20,7 @@ func TestMerkleRoot(t *testing.T) {
                                []byte("00000"),
                        },
                },
                                []byte("00000"),
                        },
                },
-               want: mustDecodeHash("ddf6b62a276929250336a294b1f1863fe979a0f418f02aa9d098fca775573c3c"),
+               want: mustDecodeHash("323f847f14a3e1dca5a6b84c5daaf84a92a892ef847a76731cf2ada283687e16"),
        }, {
                witnesses: [][][]byte{
                        [][]byte{
        }, {
                witnesses: [][][]byte{
                        [][]byte{
@@ -32,7 +32,7 @@ func TestMerkleRoot(t *testing.T) {
                                []byte("111111"),
                        },
                },
                                []byte("111111"),
                        },
                },
-               want: mustDecodeHash("c5ca521b644f9b3a393e046566a9ca8f2eafd9f46c7cebbed38fa5cc2ebb3e4c"),
+               want: mustDecodeHash("ed6ad6889d65bb7d917d9de969e559af6bfbc002f4ff0d72b99a2cf0e5cc15f0"),
        }, {
                witnesses: [][][]byte{
                        [][]byte{
        }, {
                witnesses: [][][]byte{
                        [][]byte{
@@ -45,7 +45,7 @@ func TestMerkleRoot(t *testing.T) {
                                []byte("222222"),
                        },
                },
                                []byte("222222"),
                        },
                },
-               want: mustDecodeHash("c5ca521b644f9b3a393e046566a9ca8f2eafd9f46c7cebbed38fa5cc2ebb3e4c"),
+               want: mustDecodeHash("ed6ad6889d65bb7d917d9de969e559af6bfbc002f4ff0d72b99a2cf0e5cc15f0"),
        }}
 
        for _, c := range cases {
        }}
 
        for _, c := range cases {
index 8eefd40..f133858 100644 (file)
@@ -12,17 +12,15 @@ func (h *TxHeader) writeForHash(w io.Writer) {
        mustWriteForHash(w, h.Version)
        mustWriteForHash(w, h.TimeRange)
        mustWriteForHash(w, h.ResultIds)
        mustWriteForHash(w, h.Version)
        mustWriteForHash(w, h.TimeRange)
        mustWriteForHash(w, h.ResultIds)
-       mustWriteForHash(w, h.Data)
        mustWriteForHash(w, h.ExtHash)
 }
 
 // NewTxHeader creates an new TxHeader.
        mustWriteForHash(w, h.ExtHash)
 }
 
 // NewTxHeader creates an new TxHeader.
-func NewTxHeader(version, serializedSize, timeRange uint64, resultIDs []*Hash, data *Hash) *TxHeader {
+func NewTxHeader(version, serializedSize, timeRange uint64, resultIDs []*Hash) *TxHeader {
        return &TxHeader{
                Version:        version,
                SerializedSize: serializedSize,
                TimeRange:      timeRange,
                ResultIds:      resultIDs,
        return &TxHeader{
                Version:        version,
                SerializedSize: serializedSize,
                TimeRange:      timeRange,
                ResultIds:      resultIDs,
-               Data:           data,
        }
 }
        }
 }
index 1c7ea8b..30c421b 100644 (file)
@@ -627,7 +627,6 @@ func sample(tb testing.TB, in *txFixture) *txFixture {
                Version:       result.txVersion,
                Inputs:        result.txInputs,
                Outputs:       result.txOutputs,
                Version:       result.txVersion,
                Inputs:        result.txInputs,
                Outputs:       result.txOutputs,
-               ReferenceData: result.txRefData,
        }
 
        return &result
        }
 
        return &result
index 1eaf6ac..12a90ae 100644 (file)
@@ -16,7 +16,6 @@ func NewTxVMContext(vs *validationState, entry bc.Entry, prog *bc.Program, args
                tx          = vs.tx
                blockHeight = vs.block.BlockHeader.GetHeight()
                numResults  = uint64(len(tx.ResultIds))
                tx          = vs.tx
                blockHeight = vs.block.BlockHeader.GetHeight()
                numResults  = uint64(len(tx.ResultIds))
-               txData      = tx.Data.Bytes()
                entryID     = bc.EntryID(entry) // TODO(bobg): pass this in, don't recompute it
 
                assetID       *[]byte
                entryID     = bc.EntryID(entry) // TODO(bobg): pass this in, don't recompute it
 
                assetID       *[]byte
@@ -103,7 +102,6 @@ func NewTxVMContext(vs *validationState, entry bc.Entry, prog *bc.Program, args
                AssetID:       assetID,
                Amount:        amount,
                EntryData:     entryData,
                AssetID:       assetID,
                Amount:        amount,
                EntryData:     entryData,
-               TxData:        &txData,
                DestPos:       destPos,
                AnchorID:      anchorID,
                SpentOutputID: spentOutputID,
                DestPos:       destPos,
                AnchorID:      anchorID,
                SpentOutputID: spentOutputID,
index b31471b..ef0825b 100644 (file)
@@ -13,7 +13,6 @@ import (
 
 func TestCheckOutput(t *testing.T) {
        tx := legacy.NewTx(legacy.TxData{
 
 func TestCheckOutput(t *testing.T) {
        tx := legacy.NewTx(legacy.TxData{
-               ReferenceData: []byte("txref"),
                Inputs: []*legacy.TxInput{
                        legacy.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendprog"), bc.Hash{}, []byte("ref")),
                        legacy.NewIssuanceInput(nil, 6, nil, bc.Hash{}, []byte("issueprog"), nil, nil),
                Inputs: []*legacy.TxInput{
                        legacy.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendprog"), bc.Hash{}, []byte("ref")),
                        legacy.NewIssuanceInput(nil, 6, nil, bc.Hash{}, []byte("issueprog"), nil, nil),
index 12ddfae..76c6500 100644 (file)
@@ -28,7 +28,6 @@ type Context struct {
        AssetID       *[]byte
        Amount        *uint64
        EntryData     *[]byte
        AssetID       *[]byte
        Amount        *uint64
        EntryData     *[]byte
-       TxData        *[]byte
        DestPos       *uint64
        AnchorID      *[]byte
        SpentOutputID *[]byte
        DestPos       *uint64
        AnchorID      *[]byte
        SpentOutputID *[]byte
index 5712756..576f41f 100644 (file)
@@ -97,18 +97,6 @@ func opEntryData(vm *virtualMachine) error {
        return vm.push(*vm.context.EntryData, true)
 }
 
        return vm.push(*vm.context.EntryData, true)
 }
 
-func opTxData(vm *virtualMachine) error {
-       err := vm.applyCost(1)
-       if err != nil {
-               return err
-       }
-
-       if vm.context.TxData == nil {
-               return ErrContext
-       }
-       return vm.push(*vm.context.TxData, true)
-}
-
 func opIndex(vm *virtualMachine) error {
        err := vm.applyCost(1)
        if err != nil {
 func opIndex(vm *virtualMachine) error {
        err := vm.applyCost(1)
        if err != nil {
index 86493f9..e9303e8 100644 (file)
@@ -119,7 +119,6 @@ func TestIntrospectionOps(t *testing.T) {
        entryID := mustDecodeHex("2e68d78cdeaa98944c12512cf9c719eb4881e9afb61e4b766df5f369aee6392c")
        entryData := mustDecodeHex("44be5e14ce216f4b2c35a5eb0b35d078bda55cf05b5d36ee0e7a01fbc6ef62b7")
        assetID := mustDecodeHex("0100000000000000000000000000000000000000000000000000000000000000")
        entryID := mustDecodeHex("2e68d78cdeaa98944c12512cf9c719eb4881e9afb61e4b766df5f369aee6392c")
        entryData := mustDecodeHex("44be5e14ce216f4b2c35a5eb0b35d078bda55cf05b5d36ee0e7a01fbc6ef62b7")
        assetID := mustDecodeHex("0100000000000000000000000000000000000000000000000000000000000000")
-       txData := mustDecodeHex("3e5190f2691e6d451c50edf9a9a66a7a6779c787676452810dbf4f6e4053682c")
 
        type testStruct struct {
                op      Op
 
        type testStruct struct {
                op      Op
@@ -268,16 +267,6 @@ func TestIntrospectionOps(t *testing.T) {
                        dataStack:    [][]byte{[]byte("issueprog")},
                },
        }, {
                        dataStack:    [][]byte{[]byte("issueprog")},
                },
        }, {
-               op: OP_TXDATA,
-               startVM: &virtualMachine{
-                       context: &Context{TxData: &txData},
-               },
-               wantVM: &virtualMachine{
-                       runLimit:     49959,
-                       deferredCost: 40,
-                       dataStack:    [][]byte{txData},
-               },
-       }, {
                op: OP_ENTRYDATA,
                startVM: &virtualMachine{
                        context: &Context{EntryData: &entryData},
                op: OP_ENTRYDATA,
                startVM: &virtualMachine{
                        context: &Context{EntryData: &entryData},
@@ -311,7 +300,7 @@ func TestIntrospectionOps(t *testing.T) {
 
        txops := []Op{
                OP_CHECKOUTPUT, OP_ASSET, OP_AMOUNT, OP_PROGRAM,
 
        txops := []Op{
                OP_CHECKOUTPUT, OP_ASSET, OP_AMOUNT, OP_PROGRAM,
-               OP_TXDATA, OP_ENTRYDATA, OP_INDEX, OP_OUTPUTID,
+               OP_ENTRYDATA, OP_INDEX, OP_OUTPUTID,
        }
 
        for _, op := range txops {
        }
 
        for _, op := range txops {
index da0cda9..f9f0cee 100644 (file)
@@ -205,7 +205,6 @@ const (
        OP_ASSET       Op = 0xc2
        OP_AMOUNT      Op = 0xc3
        OP_PROGRAM     Op = 0xc4
        OP_ASSET       Op = 0xc2
        OP_AMOUNT      Op = 0xc3
        OP_PROGRAM     Op = 0xc4
-       OP_TXDATA      Op = 0xc7
        OP_ENTRYDATA   Op = 0xc8
        OP_INDEX       Op = 0xc9
        OP_ENTRYID     Op = 0xca
        OP_ENTRYDATA   Op = 0xc8
        OP_INDEX       Op = 0xc9
        OP_ENTRYID     Op = 0xca
@@ -314,7 +313,6 @@ var (
                OP_ASSET:       {OP_ASSET, "ASSET", opAsset},
                OP_AMOUNT:      {OP_AMOUNT, "AMOUNT", opAmount},
                OP_PROGRAM:     {OP_PROGRAM, "PROGRAM", opProgram},
                OP_ASSET:       {OP_ASSET, "ASSET", opAsset},
                OP_AMOUNT:      {OP_AMOUNT, "AMOUNT", opAmount},
                OP_PROGRAM:     {OP_PROGRAM, "PROGRAM", opProgram},
-               OP_TXDATA:      {OP_TXDATA, "TXDATA", opTxData},
                OP_ENTRYDATA:   {OP_ENTRYDATA, "ENTRYDATA", opEntryData},
                OP_INDEX:       {OP_INDEX, "INDEX", opIndex},
                OP_ENTRYID:     {OP_ENTRYID, "ENTRYID", opEntryID},
                OP_ENTRYDATA:   {OP_ENTRYDATA, "ENTRYDATA", opEntryData},
                OP_INDEX:       {OP_INDEX, "INDEX", opIndex},
                OP_ENTRYID:     {OP_ENTRYID, "ENTRYID", opEntryID},