OSDN Git Service

2d data for butxo state (#1921)
authorboomyl <563807243@qq.com>
Sun, 25 Apr 2021 08:51:06 +0000 (16:51 +0800)
committerGitHub <noreply@github.com>
Sun, 25 Apr 2021 08:51:06 +0000 (16:51 +0800)
24 files changed:
account/utxo_keeper.go
blockchain/txbuilder/actions.go
netsync/chainmgr/tx_keeper_test.go
netsync/peers/peer_test.go
proposal/proposal.go
protocol/bc/bc.pb.go
protocol/bc/bc.proto
protocol/bc/entry_test.go
protocol/bc/types/block_test.go
protocol/bc/types/map_test.go
protocol/bc/types/original_output.go
protocol/bc/types/output_commitment.go
protocol/bc/types/output_commitment_test.go
protocol/bc/types/spend.go
protocol/bc/types/spend_commitment.go
protocol/bc/types/spend_commitment_test.go
protocol/bc/types/spend_test.go
protocol/bc/types/transaction_test.go
protocol/bc/types/txinput_test.go
protocol/bc/types/txoutput_test.go
protocol/bc/types/veto_input.go
protocol/bc/types/vote_output.go
protocol/validation/tx_scene_test.go
test/integration/block_integration_test.go

index 19e480d..2b48f8c 100644 (file)
@@ -34,7 +34,7 @@ type UTXO struct {
        Amount              uint64
        SourcePos           uint64
        ControlProgram      []byte
-       StateData           []byte
+       StateData           [][]byte
        AccountID           string
        Address             string
        ControlProgramIndex uint64
index fe03218..e155c4a 100644 (file)
@@ -176,7 +176,7 @@ func (a *registerAction) Build(ctx context.Context, b *TemplateBuilder) error {
        if err != nil {
                return err
        }
-       out := types.NewOriginalTxOutput(*a.AssetId, a.Amount, program, []byte{})
+       out := types.NewOriginalTxOutput(*a.AssetId, a.Amount, program, [][]byte{})
        return b.AddOutput(out)
 }
 
index 7a16859..4fa044a 100644 (file)
@@ -27,7 +27,7 @@ type mempool struct {
 func (m *mempool) GetTransactions() []*core.TxDesc {
        txs := []*core.TxDesc{}
        for i := 0; i < txsNumber; i++ {
-               txInput := types.NewSpendInput(nil, bc.NewHash([32]byte{0x01}), *consensus.BTMAssetID, uint64(i), 1, []byte{0x51}, []byte{})
+               txInput := types.NewSpendInput(nil, bc.NewHash([32]byte{0x01}), *consensus.BTMAssetID, uint64(i), 1, []byte{0x51}, [][]byte{})
                txInput.CommitmentSuffix = []byte{0, 1, 2}
                txInput.WitnessSuffix = []byte{0, 1, 2}
 
@@ -39,7 +39,7 @@ func (m *mempool) GetTransactions() []*core.TxDesc {
                                        txInput,
                                },
                                Outputs: []*types.TxOutput{
-                                       types.NewOriginalTxOutput(*consensus.BTMAssetID, uint64(i), []byte{0x6a}, []byte{}),
+                                       types.NewOriginalTxOutput(*consensus.BTMAssetID, uint64(i), []byte{0x6a}, [][]byte{}),
                                },
                                SerializedSize: 1000,
                        },
index 942a017..b0e217c 100644 (file)
@@ -96,10 +96,10 @@ func TestAddFilterAddresses(t *testing.T) {
        peer := newPeer(&basePeer{})
        tx := types.NewTx(types.TxData{
                Inputs: []*types.TxInput{
-                       types.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendProgram"), []byte{}),
+                       types.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendProgram"), [][]byte{}),
                },
                Outputs: []*types.TxOutput{
-                       types.NewOriginalTxOutput(bc.NewAssetID([32]byte{3}), 8, []byte("outProgram"), []byte{}),
+                       types.NewOriginalTxOutput(bc.NewAssetID([32]byte{3}), 8, []byte("outProgram"), [][]byte{}),
                },
        })
 
@@ -118,10 +118,10 @@ func TestFilterClear(t *testing.T) {
        peer := newPeer(&basePeer{})
        tx := types.NewTx(types.TxData{
                Inputs: []*types.TxInput{
-                       types.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendProgram"), []byte{}),
+                       types.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendProgram"), [][]byte{}),
                },
                Outputs: []*types.TxOutput{
-                       types.NewOriginalTxOutput(bc.NewAssetID([32]byte{3}), 8, []byte("outProgram"), []byte{}),
+                       types.NewOriginalTxOutput(bc.NewAssetID([32]byte{3}), 8, []byte("outProgram"), [][]byte{}),
                },
        })
 
@@ -141,26 +141,26 @@ func TestGetRelatedTxAndStatus(t *testing.T) {
        txs := []*types.Tx{
                types.NewTx(types.TxData{
                        Inputs: []*types.TxInput{
-                               types.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendProgram1"), []byte{}),
+                               types.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendProgram1"), [][]byte{}),
                        },
                        Outputs: []*types.TxOutput{
-                               types.NewOriginalTxOutput(bc.NewAssetID([32]byte{3}), 8, []byte("outProgram1"), []byte{}),
+                               types.NewOriginalTxOutput(bc.NewAssetID([32]byte{3}), 8, []byte("outProgram1"), [][]byte{}),
                        },
                }),
                types.NewTx(types.TxData{
                        Inputs: []*types.TxInput{
-                               types.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendProgram2"), []byte{}),
+                               types.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendProgram2"), [][]byte{}),
                        },
                        Outputs: []*types.TxOutput{
-                               types.NewOriginalTxOutput(bc.NewAssetID([32]byte{3}), 8, []byte("outProgram2"), []byte{}),
+                               types.NewOriginalTxOutput(bc.NewAssetID([32]byte{3}), 8, []byte("outProgram2"), [][]byte{}),
                        },
                }),
                types.NewTx(types.TxData{
                        Inputs: []*types.TxInput{
-                               types.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendProgram3"), []byte{}),
+                               types.NewSpendInput(nil, bc.Hash{}, bc.NewAssetID([32]byte{1}), 5, 1, []byte("spendProgram3"), [][]byte{}),
                        },
                        Outputs: []*types.TxOutput{
-                               types.NewOriginalTxOutput(bc.NewAssetID([32]byte{3}), 8, []byte("outProgram3"), []byte{}),
+                               types.NewOriginalTxOutput(bc.NewAssetID([32]byte{3}), 8, []byte("outProgram3"), [][]byte{}),
                        },
                }),
        }
index 036a693..f8c4c40 100644 (file)
@@ -158,7 +158,7 @@ func (b *blockBuilder) createCoinbaseTx() (tx *types.Tx, err error) {
                return nil, err
        }
 
-       if err = builder.AddOutput(types.NewOriginalTxOutput(*consensus.BTMAssetID, 0, script, []byte{})); err != nil {
+       if err = builder.AddOutput(types.NewOriginalTxOutput(*consensus.BTMAssetID, 0, script, [][]byte{})); err != nil {
                return nil, err
        }
        //TODO: calculate reward to proposer
index 833c9fb..21c73f2 100644 (file)
@@ -111,7 +111,7 @@ func (m *Program) GetCode() []byte {
 }
 
 type StateData struct {
-       StateData []byte `protobuf:"bytes,1,opt,name=state_data,json=stateData,proto3" json:"state_data,omitempty"`
+       StateData [][]byte `protobuf:"bytes,1,rep,name=state_data,json=stateData,proto3" json:"state_data,omitempty"`
 }
 
 func (m *StateData) Reset()                    { *m = StateData{} }
@@ -119,7 +119,7 @@ func (m *StateData) String() string            { return proto.CompactTextString(
 func (*StateData) ProtoMessage()               {}
 func (*StateData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
 
-func (m *StateData) GetStateData() []byte {
+func (m *StateData) GetStateData() [][]byte {
        if m != nil {
                return m.StateData
        }
@@ -749,64 +749,64 @@ func init() {
 func init() { proto.RegisterFile("bc.proto", fileDescriptor0) }
 
 var fileDescriptor0 = []byte{
-       // 931 bytes of a gzipped FileDescriptorProto
-       0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xdd, 0x6e, 0xdb, 0x36,
-       0x14, 0x86, 0x64, 0xf9, 0xef, 0xd8, 0x89, 0x13, 0xa6, 0x28, 0x84, 0xa2, 0xc3, 0x0a, 0x01, 0x5d,
-       0xf6, 0x87, 0x20, 0x3f, 0xdd, 0x76, 0xb3, 0x9b, 0x6c, 0x59, 0x57, 0x5f, 0x04, 0x1d, 0xe8, 0xc0,
-       0xb7, 0x02, 0x6d, 0xd1, 0x36, 0x31, 0x5b, 0xf4, 0x48, 0x4a, 0x4b, 0xf3, 0x1e, 0x7b, 0x8e, 0x5d,
-       0xee, 0x11, 0x0a, 0x6c, 0xd8, 0x3b, 0x0d, 0x3c, 0xa2, 0x2c, 0x3b, 0x71, 0x9b, 0x16, 0xc3, 0x30,
-       0xf4, 0x4e, 0xe7, 0x87, 0x1f, 0xcf, 0xf9, 0xce, 0x47, 0x52, 0xd0, 0x1a, 0x8d, 0x8f, 0x96, 0x4a,
-       0x1a, 0x49, 0xfc, 0xd1, 0x38, 0x7a, 0x0e, 0xc1, 0x0b, 0xa6, 0x67, 0x64, 0x17, 0xfc, 0xfc, 0x38,
-       0xf4, 0x9e, 0x78, 0x9f, 0x36, 0xa8, 0x9f, 0x1f, 0xa3, 0x7d, 0x12, 0xfa, 0xce, 0x3e, 0x41, 0xfb,
-       0x34, 0xac, 0x39, 0xfb, 0x14, 0xed, 0xb3, 0x30, 0x70, 0xf6, 0x59, 0xf4, 0x2d, 0x34, 0x7f, 0x52,
+       // 933 bytes of a gzipped FileDescriptorProto
+       0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xdb, 0x6e, 0xdb, 0x36,
+       0x18, 0x86, 0x64, 0xf9, 0xf4, 0xdb, 0x8d, 0x13, 0xa6, 0x28, 0x84, 0xa2, 0xc3, 0x02, 0x01, 0x5d,
+       0xba, 0x03, 0x82, 0x1c, 0xba, 0xed, 0x66, 0x37, 0xd9, 0xb2, 0xae, 0xbe, 0x08, 0x3a, 0xd0, 0x81,
+       0x6f, 0x05, 0xda, 0xa2, 0x6d, 0x62, 0xb6, 0xe8, 0x91, 0x94, 0x96, 0xe6, 0x3d, 0xf6, 0x1c, 0xbb,
+       0xdc, 0x23, 0x14, 0xd8, 0xb0, 0x77, 0x1a, 0xf8, 0x8b, 0xb2, 0xec, 0xc4, 0x6d, 0x5a, 0x0c, 0xc3,
+       0xb0, 0x3b, 0xff, 0x07, 0x7f, 0xfc, 0xfe, 0x8f, 0x1f, 0x49, 0x41, 0x6b, 0x34, 0x3e, 0x5a, 0x2a,
+       0x69, 0x24, 0xf1, 0x47, 0xe3, 0xe8, 0x05, 0x04, 0x2f, 0x99, 0x9e, 0x91, 0x1d, 0xf0, 0xf3, 0xe3,
+       0xd0, 0x3b, 0xf0, 0x9e, 0x35, 0xa8, 0x9f, 0x1f, 0x63, 0x7c, 0x12, 0xfa, 0x2e, 0x3e, 0xc1, 0xf8,
+       0x34, 0xac, 0xb9, 0xf8, 0x14, 0xe3, 0xb3, 0x30, 0x70, 0xf1, 0x59, 0xf4, 0x0d, 0x34, 0x7f, 0x54,
        0x72, 0xaa, 0xd8, 0x82, 0x7c, 0x04, 0x90, 0x2f, 0xe2, 0x9c, 0x2b, 0x2d, 0x64, 0x8a, 0x90, 0x01,
-       0x6d, 0xe7, 0x8b, 0x61, 0xe1, 0x20, 0x04, 0x82, 0xb1, 0x4c, 0x38, 0x62, 0x77, 0x29, 0x7e, 0x47,
-       0x9f, 0x43, 0x7b, 0x60, 0x98, 0xe1, 0x17, 0xcc, 0x30, 0xbb, 0x5e, 0x5b, 0x23, 0x4e, 0x98, 0x61,
-       0xb8, 0xbe, 0x4b, 0xdb, 0xba, 0x0c, 0x47, 0x7d, 0x68, 0x9e, 0x6b, 0xcd, 0x4d, 0xff, 0xe2, 0x5f,
-       0x17, 0x7d, 0x09, 0x1d, 0x84, 0x3a, 0x5f, 0xc8, 0x2c, 0x35, 0xe4, 0x13, 0x68, 0x31, 0x6b, 0xc6,
-       0x22, 0x41, 0xd0, 0xce, 0x69, 0xe7, 0x68, 0x34, 0x3e, 0x72, 0xbb, 0xd1, 0x26, 0x06, 0xfb, 0x09,
-       0x79, 0x08, 0x0d, 0x86, 0x2b, 0x70, 0xab, 0x80, 0x3a, 0x2b, 0x9a, 0x42, 0x0f, 0x73, 0x2f, 0xf8,
-       0x44, 0xa4, 0xc2, 0xd8, 0x66, 0xbf, 0x86, 0x3d, 0xa1, 0x75, 0xc6, 0xd2, 0x31, 0x8f, 0x97, 0x05,
-       0x3f, 0xeb, 0xd0, 0x8e, 0x32, 0xda, 0x2b, 0x93, 0x4a, 0x0e, 0x1f, 0x43, 0x80, 0xdd, 0xfb, 0x98,
-       0xdb, 0xb2, 0xb9, 0x76, 0x4c, 0x14, 0xbd, 0xd1, 0x1c, 0x3a, 0x43, 0x36, 0xcf, 0xf8, 0x40, 0x66,
-       0x6a, 0xcc, 0xc9, 0x23, 0xa8, 0x29, 0x3e, 0x71, 0xb8, 0x55, 0xae, 0x75, 0x92, 0xa7, 0x50, 0xcf,
-       0x6d, 0xaa, 0x43, 0xea, 0xad, 0x1a, 0x2a, 0x7a, 0xa6, 0x45, 0x94, 0x3c, 0x82, 0xd6, 0x52, 0x6a,
-       0xac, 0x19, 0xf9, 0x0a, 0xe8, 0xca, 0x8e, 0x7e, 0x81, 0x3d, 0xdc, 0xed, 0x82, 0x6b, 0x23, 0x52,
-       0x86, 0x7d, 0xfd, 0xc7, 0x5b, 0xfe, 0xe9, 0x41, 0xe7, 0xbb, 0xb9, 0x1c, 0xff, 0xfc, 0x82, 0xb3,
-       0x84, 0x2b, 0x12, 0x42, 0x73, 0x53, 0x4f, 0xa5, 0x69, 0x67, 0x31, 0xe3, 0x62, 0x3a, 0x5b, 0xcd,
-       0xa2, 0xb0, 0xc8, 0x33, 0xd8, 0x5f, 0x2a, 0x9e, 0x0b, 0x99, 0xe9, 0x78, 0x64, 0x91, 0xec, 0x50,
-       0x6b, 0xb7, 0xca, 0xed, 0x95, 0x29, 0xb8, 0x57, 0x3f, 0x21, 0x8f, 0xa1, 0x6d, 0xc4, 0x82, 0x6b,
-       0xc3, 0x16, 0x4b, 0xd4, 0x49, 0x40, 0x2b, 0x07, 0xf9, 0x0a, 0xf6, 0x8d, 0x62, 0xa9, 0x66, 0x63,
-       0x5b, 0xa4, 0x8e, 0x95, 0x94, 0x26, 0xac, 0xdf, 0xc2, 0xdc, 0x5b, 0x4f, 0xa1, 0x52, 0x9a, 0xe8,
-       0x37, 0x0f, 0x5a, 0x57, 0xd7, 0xf7, 0x76, 0x72, 0x08, 0x3d, 0xcd, 0x95, 0x60, 0x73, 0x71, 0xc3,
-       0x93, 0x58, 0x8b, 0x1b, 0xee, 0x5a, 0xda, 0xad, 0xdc, 0x03, 0x71, 0xc3, 0xed, 0xf9, 0xb0, 0x35,
-       0xc5, 0x8a, 0xa5, 0x53, 0xee, 0xa8, 0xc3, 0x2a, 0xa9, 0x75, 0x90, 0x43, 0x00, 0xc5, 0x75, 0x36,
-       0xb7, 0x32, 0xd6, 0x61, 0xf0, 0xa4, 0xb6, 0x51, 0x5e, 0xbb, 0x88, 0xf5, 0x13, 0x1d, 0x9d, 0xc0,
-       0xee, 0xd5, 0xf5, 0x90, 0x2b, 0x31, 0x79, 0x45, 0xd1, 0x49, 0x3e, 0x86, 0x8e, 0x3d, 0x67, 0x99,
-       0x8e, 0x27, 0x4c, 0xcc, 0xb1, 0xc0, 0x16, 0x85, 0xc2, 0xf5, 0x9c, 0x89, 0x79, 0x34, 0x81, 0xfd,
-       0xab, 0xaa, 0xbd, 0x01, 0x06, 0xde, 0xd2, 0xd2, 0x37, 0xb0, 0x93, 0x23, 0x7e, 0x5c, 0x60, 0x84,
-       0x3e, 0x56, 0x43, 0x6c, 0x35, 0x9b, 0x5b, 0xd3, 0x6e, 0x91, 0x58, 0x40, 0x46, 0x7f, 0x7b, 0x50,
-       0xbb, 0xcc, 0xae, 0xc9, 0x67, 0xd0, 0xd4, 0xa8, 0x71, 0x1d, 0x7a, 0xb8, 0x14, 0xc5, 0xb4, 0xa6,
-       0x7d, 0x5a, 0xc6, 0xc9, 0x53, 0x68, 0x96, 0x07, 0xcc, 0xbf, 0x7b, 0xc0, 0xca, 0x18, 0xf9, 0x11,
-       0x1e, 0xfc, 0x2a, 0x4c, 0xca, 0xb5, 0x8e, 0x93, 0x4a, 0xcf, 0x3a, 0xac, 0x21, 0xfc, 0x83, 0x15,
-       0xfc, 0x9a, 0xd8, 0xe9, 0x81, 0x5b, 0xb1, 0xe6, 0xd3, 0xe4, 0x0b, 0xd8, 0x2f, 0x81, 0x98, 0x9a,
-       0x66, 0x0b, 0x9e, 0x9a, 0x82, 0xed, 0x2e, 0xdd, 0x73, 0x81, 0xf3, 0xd2, 0x1f, 0x49, 0x68, 0x7d,
-       0x2f, 0x45, 0x3a, 0x62, 0x9a, 0x93, 0x1f, 0xe0, 0x60, 0x4b, 0x05, 0xee, 0x28, 0x6d, 0x2f, 0x80,
-       0xdc, 0x2d, 0xc0, 0x4a, 0x95, 0xa9, 0x91, 0x30, 0x8a, 0xa9, 0x57, 0xee, 0x2e, 0xad, 0x1c, 0xd1,
-       0xef, 0x1e, 0x34, 0x5e, 0x66, 0x66, 0x99, 0x19, 0x72, 0x08, 0x8d, 0x82, 0x23, 0xb7, 0xc5, 0x1d,
-       0x0a, 0x5d, 0x98, 0x3c, 0x83, 0xde, 0x58, 0xa6, 0x46, 0xc9, 0x79, 0xfc, 0x16, 0x26, 0x77, 0x5d,
-       0x4e, 0x79, 0x53, 0x85, 0xd0, 0x94, 0x2a, 0x11, 0x29, 0x9b, 0x3b, 0x29, 0x96, 0x26, 0xf9, 0x72,
-       0xe3, 0x1e, 0x0f, 0x10, 0x6a, 0xc7, 0x42, 0xad, 0xae, 0xfa, 0xf5, 0x6b, 0xfd, 0xb5, 0x07, 0x30,
-       0x94, 0x86, 0xff, 0xdf, 0x55, 0x13, 0x08, 0x72, 0x69, 0x38, 0xd6, 0xdb, 0xa5, 0xf8, 0x7d, 0xab,
-       0x93, 0xfa, 0x3d, 0x9d, 0xfc, 0xe5, 0x41, 0x7b, 0xc8, 0x8d, 0xec, 0xa7, 0xb6, 0x91, 0x63, 0xe8,
-       0xe9, 0x25, 0x4f, 0x4d, 0x2c, 0xb1, 0xb1, 0xea, 0x6d, 0xa9, 0xce, 0xe4, 0x0e, 0x26, 0x14, 0x8d,
-       0xf7, 0x93, 0x37, 0x09, 0xc4, 0x7f, 0x4f, 0x81, 0x6c, 0x15, 0x68, 0x6d, 0xbb, 0x40, 0xd7, 0xf9,
-       0x08, 0x36, 0xf8, 0x88, 0x5e, 0x02, 0x50, 0x6e, 0x84, 0xe2, 0x36, 0xf1, 0xdd, 0xc7, 0xb2, 0x06,
-       0xe8, 0x6f, 0x02, 0xfe, 0xe1, 0x43, 0xab, 0xef, 0x9e, 0x3b, 0x7b, 0x59, 0xa5, 0xd2, 0x3e, 0x8e,
-       0x33, 0xa6, 0x67, 0x77, 0x88, 0x69, 0x63, 0x0c, 0xff, 0x4f, 0xde, 0xf1, 0x51, 0x79, 0x03, 0x77,
-       0xb5, 0xf7, 0xe4, 0xee, 0x12, 0xc2, 0x15, 0x77, 0xf8, 0x47, 0x90, 0xac, 0x9e, 0x74, 0x27, 0xe4,
-       0x83, 0x55, 0x01, 0xd5, 0x6b, 0x4f, 0x1f, 0x96, 0xbc, 0xde, 0xfa, 0x0b, 0xd8, 0x3a, 0x8a, 0xfa,
-       0xfd, 0xa3, 0x68, 0x6c, 0x32, 0xf7, 0xda, 0x83, 0xfa, 0x60, 0xc9, 0xd3, 0xe4, 0x43, 0x17, 0xd5,
-       0xa8, 0x81, 0x3f, 0xa0, 0x67, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x36, 0x73, 0x4e, 0x8c,
-       0x0a, 0x00, 0x00,
+       0x6d, 0xe7, 0x8b, 0x61, 0x91, 0x20, 0x04, 0x82, 0xb1, 0x4c, 0x38, 0x62, 0x77, 0x29, 0xfe, 0x8e,
+       0x3e, 0x83, 0xf6, 0xc0, 0x30, 0xc3, 0x2f, 0x98, 0x61, 0xf6, 0xff, 0xda, 0x06, 0x71, 0xc2, 0x0c,
+       0x0b, 0xbd, 0x83, 0xda, 0xb3, 0x2e, 0x6d, 0xeb, 0xb2, 0x1c, 0xf5, 0xa1, 0x79, 0xae, 0x35, 0x37,
+       0xfd, 0x8b, 0x7f, 0x4c, 0xfa, 0x12, 0x3a, 0x08, 0x75, 0xbe, 0x90, 0x59, 0x6a, 0xc8, 0x27, 0xd0,
+       0x62, 0x36, 0x8c, 0x45, 0x82, 0xa0, 0x9d, 0xd3, 0xce, 0xd1, 0x68, 0x7c, 0xe4, 0x56, 0xa3, 0x4d,
+       0x2c, 0xf6, 0x13, 0xf2, 0x08, 0x1a, 0x0c, 0xff, 0x81, 0x4b, 0x05, 0xd4, 0x45, 0xd1, 0x14, 0x7a,
+       0xd8, 0x7b, 0xc1, 0x27, 0x22, 0x15, 0xc6, 0x0e, 0xfb, 0x15, 0xec, 0x0a, 0xad, 0x33, 0x96, 0x8e,
+       0x79, 0xbc, 0x2c, 0xf4, 0x59, 0x87, 0x76, 0x92, 0xd1, 0x5e, 0xd9, 0x54, 0x6a, 0xf8, 0x04, 0x02,
+       0x9c, 0xde, 0xc7, 0xde, 0x96, 0xed, 0xb5, 0xdb, 0x44, 0x31, 0x1b, 0xcd, 0xa1, 0x33, 0x64, 0xf3,
+       0x8c, 0x0f, 0x64, 0xa6, 0xc6, 0x9c, 0x3c, 0x86, 0x9a, 0xe2, 0x13, 0x87, 0x5b, 0xf5, 0xda, 0x24,
+       0x79, 0x0a, 0xf5, 0xdc, 0xb6, 0x3a, 0xa4, 0xde, 0x6a, 0xa0, 0x62, 0x66, 0x5a, 0x54, 0xc9, 0x63,
+       0x68, 0x2d, 0xa5, 0x46, 0xce, 0xa8, 0x57, 0x40, 0x57, 0x71, 0xf4, 0x33, 0xec, 0xe2, 0x6a, 0x17,
+       0x5c, 0x1b, 0x91, 0x32, 0x9c, 0xeb, 0x5f, 0x5e, 0xf2, 0x0f, 0x0f, 0x3a, 0xdf, 0xce, 0xe5, 0xf8,
+       0xa7, 0x97, 0x9c, 0x25, 0x5c, 0x91, 0x10, 0x9a, 0x9b, 0x7e, 0x2a, 0x43, 0xbb, 0x17, 0x33, 0x2e,
+       0xa6, 0xb3, 0xd5, 0x5e, 0x14, 0x11, 0x79, 0x0e, 0x7b, 0x4b, 0xc5, 0x73, 0x21, 0x33, 0x1d, 0x8f,
+       0x2c, 0x92, 0xdd, 0xd4, 0xda, 0x2d, 0xba, 0xbd, 0xb2, 0x05, 0xd7, 0xea, 0x27, 0xe4, 0x09, 0xb4,
+       0x8d, 0x58, 0x70, 0x6d, 0xd8, 0x62, 0x89, 0x3e, 0x09, 0x68, 0x95, 0x20, 0x5f, 0xc2, 0x9e, 0x51,
+       0x2c, 0xd5, 0x6c, 0x6c, 0x49, 0xea, 0x58, 0x49, 0x69, 0xc2, 0xfa, 0x2d, 0xcc, 0xdd, 0xf5, 0x16,
+       0x2a, 0xa5, 0x89, 0x7e, 0xf5, 0xa0, 0x75, 0x75, 0x7d, 0xef, 0x24, 0x87, 0xd0, 0xd3, 0x5c, 0x09,
+       0x36, 0x17, 0x37, 0x3c, 0x89, 0xb5, 0xb8, 0xe1, 0x6e, 0xa4, 0x9d, 0x2a, 0x3d, 0x10, 0x37, 0xdc,
+       0x9e, 0x0f, 0xcb, 0x29, 0x56, 0x2c, 0x9d, 0x72, 0x27, 0x1d, 0xb2, 0xa4, 0x36, 0x41, 0x0e, 0x01,
+       0x14, 0xd7, 0xd9, 0xdc, 0xda, 0x58, 0x87, 0xc1, 0x41, 0x6d, 0x83, 0x5e, 0xbb, 0xa8, 0xf5, 0x13,
+       0x1d, 0x9d, 0xc0, 0xce, 0xd5, 0xf5, 0x90, 0x2b, 0x31, 0x79, 0x4d, 0x31, 0x49, 0x3e, 0x86, 0x8e,
+       0x3d, 0x67, 0x99, 0x8e, 0x27, 0x4c, 0xcc, 0x91, 0x60, 0x8b, 0x42, 0x91, 0x7a, 0xc1, 0xc4, 0x3c,
+       0x9a, 0xc0, 0xde, 0x55, 0x35, 0xde, 0x00, 0x0b, 0xef, 0x18, 0xe9, 0x6b, 0x78, 0x90, 0x23, 0x7e,
+       0x5c, 0x60, 0x84, 0x3e, 0xb2, 0x21, 0x96, 0xcd, 0xe6, 0xd2, 0xb4, 0x5b, 0x34, 0x16, 0x90, 0xd1,
+       0x5f, 0x1e, 0xd4, 0x2e, 0xb3, 0x6b, 0xf2, 0x29, 0x34, 0x35, 0x7a, 0x5c, 0xe3, 0x3d, 0xe0, 0xcc,
+       0xb4, 0xe6, 0x7d, 0x5a, 0xd6, 0xc9, 0x53, 0x68, 0x96, 0x07, 0xcc, 0xbf, 0x7b, 0xc0, 0xca, 0x1a,
+       0xf9, 0x01, 0x1e, 0xfe, 0x22, 0x4c, 0xca, 0xb5, 0x8e, 0x93, 0xca, 0xcf, 0x3a, 0xac, 0x21, 0xfc,
+       0xc3, 0x15, 0xfc, 0x9a, 0xd9, 0xe9, 0xbe, 0xfb, 0xc7, 0x5a, 0x4e, 0x93, 0xcf, 0x61, 0xaf, 0x04,
+       0x62, 0x6a, 0x9a, 0x2d, 0x78, 0x6a, 0x0a, 0xb5, 0xbb, 0x74, 0xd7, 0x15, 0xce, 0xcb, 0x7c, 0x24,
+       0xa1, 0xf5, 0x9d, 0x14, 0xe9, 0x88, 0x69, 0x4e, 0xbe, 0x87, 0xfd, 0x2d, 0x0c, 0xdc, 0x51, 0xda,
+       0x4e, 0x80, 0xdc, 0x25, 0x60, 0xad, 0xca, 0xd4, 0x48, 0x18, 0xc5, 0xd4, 0x6b, 0x77, 0x97, 0x56,
+       0x89, 0xe8, 0x37, 0x0f, 0x1a, 0xaf, 0x32, 0xb3, 0xcc, 0x0c, 0x39, 0x84, 0x46, 0xa1, 0x91, 0x5b,
+       0xe2, 0x8e, 0x84, 0xae, 0x4c, 0x9e, 0x43, 0x6f, 0x2c, 0x53, 0xa3, 0xe4, 0x3c, 0x7e, 0x87, 0x92,
+       0x3b, 0xae, 0xa7, 0xbc, 0xa9, 0x42, 0x68, 0x4a, 0x95, 0x88, 0x94, 0xcd, 0x9d, 0x15, 0xcb, 0x90,
+       0x7c, 0xb1, 0x71, 0x8f, 0x07, 0x08, 0xf5, 0xc0, 0x42, 0xad, 0xae, 0xfa, 0xf5, 0x6b, 0xfd, 0x8d,
+       0x07, 0x30, 0x94, 0x86, 0xff, 0xd7, 0xac, 0x09, 0x04, 0xb9, 0x34, 0x1c, 0xf9, 0x76, 0x29, 0xfe,
+       0xbe, 0x35, 0x49, 0xfd, 0x9e, 0x49, 0xfe, 0xf4, 0xa0, 0x3d, 0xe4, 0x46, 0xf6, 0x53, 0x3b, 0xc8,
+       0x31, 0xf4, 0xf4, 0x92, 0xa7, 0x26, 0x96, 0x38, 0x58, 0xf5, 0xb6, 0x54, 0x67, 0xf2, 0x01, 0x36,
+       0x14, 0x83, 0xf7, 0x93, 0xb7, 0x19, 0xc4, 0xff, 0x40, 0x83, 0x6c, 0x35, 0x68, 0x6d, 0xbb, 0x41,
+       0xd7, 0xf5, 0x08, 0x36, 0xf4, 0x88, 0x5e, 0x01, 0x50, 0x6e, 0x84, 0xe2, 0xb6, 0xf1, 0xfd, 0xb7,
+       0x65, 0x0d, 0xd0, 0xdf, 0x04, 0xfc, 0xdd, 0x87, 0x56, 0xdf, 0x3d, 0x77, 0xf6, 0xb2, 0x4a, 0xa5,
+       0x7d, 0x1c, 0x67, 0x4c, 0xcf, 0xee, 0x08, 0xd3, 0xc6, 0x1a, 0x7e, 0x9f, 0xbc, 0xe7, 0xa3, 0xf2,
+       0x16, 0xed, 0x6a, 0x1f, 0xa8, 0xdd, 0x25, 0x84, 0x2b, 0xed, 0xf0, 0x8b, 0x20, 0x59, 0x3d, 0xe9,
+       0xce, 0xc8, 0xfb, 0x2b, 0x02, 0xd5, 0x6b, 0x4f, 0x1f, 0x95, 0xba, 0xde, 0xfa, 0x0a, 0xd8, 0xba,
+       0x15, 0xf5, 0xfb, 0xb7, 0xa2, 0xb1, 0xa9, 0xdc, 0x1b, 0x0f, 0xea, 0x83, 0x25, 0x4f, 0x93, 0xff,
+       0xbb, 0xa9, 0x46, 0x0d, 0xfc, 0x00, 0x3d, 0xfb, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x08, 0x09,
+       0x21, 0x8c, 0x0a, 0x00, 0x00,
 }
index 0cd7549..e1246ab 100644 (file)
@@ -15,7 +15,7 @@ message Program {
 }
 
 message StateData {
-  bytes  state_data       = 1;
+  repeated bytes  state_data       = 1;
 }
 
 // This message type duplicates Hash, above. One alternative is to
index ac3e0e3..75c6c96 100644 (file)
@@ -12,7 +12,7 @@ func BenchmarkEntryID(b *testing.B) {
                NewIssuance(nil, &AssetAmount{}, 0),
                m,
                NewTxHeader(1, 1, 0, nil),
-               NewOutput(&ValueSource{}, &Program{Code: []byte{1}, VmVersion: 1}, &StateData{StateData: []byte{1}}, 0),
+               NewOutput(&ValueSource{}, &Program{Code: []byte{1}, VmVersion: 1}, &StateData{StateData: [][]byte{{1}}}, 0),
                NewRetirement(&ValueSource{}, 1),
                NewSpend(&Hash{}, 0),
        }
@@ -57,10 +57,10 @@ func TestEntryID(t *testing.T) {
                                        Position: 10,
                                },
                                &Program{VmVersion: 1, Code: []byte{5, 5, 5, 5}},
-                               &StateData{StateData: []byte{3, 4}},
+                               &StateData{StateData: [][]byte{{3, 4}}},
                                1,
                        ),
-                       expectEntryID: "cb520fa0697ecdbd6380bcd31d0d88f2727f7acf9e5af1fc192074f973e5a840",
+                       expectEntryID: "02c6841bcbdc3231a7beecefdfb4785876153080ebdc04bcd3dab308d18c8846",
                },
                {
                        entry: NewRetirement(
index 3c89b84..6f80e4f 100644 (file)
@@ -57,25 +57,25 @@ func TestBlock(t *testing.T) {
                                Transactions: []*Tx{
                                        NewTx(TxData{
                                                Version:        1,
-                                               SerializedSize: uint64(282),
+                                               SerializedSize: uint64(284),
                                                TimeRange:      654,
                                                Inputs: []*TxInput{
                                                        NewIssuanceInput([]byte("nonce"), 254354, []byte("issuanceProgram"), [][]byte{[]byte("arguments1"), []byte("arguments2")}, []byte("assetDefinition")),
-                                                       NewSpendInput([][]byte{[]byte("arguments3"), []byte("arguments4")}, testutil.MustDecodeHash("fad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409"), *consensus.BTMAssetID, 254354, 3, []byte("spendProgram"), []byte("stateData")),
+                                                       NewSpendInput([][]byte{[]byte("arguments3"), []byte("arguments4")}, testutil.MustDecodeHash("fad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409"), *consensus.BTMAssetID, 254354, 3, []byte("spendProgram"), [][]byte{[]byte("stateData")}),
                                                },
                                                Outputs: []*TxOutput{
-                                                       NewOriginalTxOutput(testutil.MustDecodeAsset("a69849e11add96ac7053aad22ba2349a4abf5feb0475a0afcadff4e128be76cf"), 254354, []byte("true"), []byte("stateData")),
+                                                       NewOriginalTxOutput(testutil.MustDecodeAsset("a69849e11add96ac7053aad22ba2349a4abf5feb0475a0afcadff4e128be76cf"), 254354, []byte("true"), [][]byte{[]byte("stateData")}),
                                                },
                                        }),
                                        NewTx(TxData{
                                                Version:        1,
-                                               SerializedSize: uint64(130),
+                                               SerializedSize: uint64(132),
                                                Inputs: []*TxInput{
                                                        NewCoinbaseInput([]byte("arbitrary")),
                                                },
                                                Outputs: []*TxOutput{
-                                                       NewOriginalTxOutput(*consensus.BTMAssetID, 254354, []byte("true"), []byte("stateData")),
-                                                       NewOriginalTxOutput(*consensus.BTMAssetID, 254354, []byte("false"), []byte("stateData")),
+                                                       NewOriginalTxOutput(*consensus.BTMAssetID, 254354, []byte("true"), [][]byte{[]byte("stateData")}),
+                                                       NewOriginalTxOutput(*consensus.BTMAssetID, 254354, []byte("false"), [][]byte{[]byte("stateData")}),
                                                },
                                        }),
                                },
@@ -91,8 +91,8 @@ func TestBlock(t *testing.T) {
                                "0100", // block witness
                                "0100", // sup links
                                "02",   // num transactions
-                               "07018e0502012a00056e6f6e6365a69849e11add96ac7053aad22ba2349a4abf5feb0475a0afcadff4e128be76cf92c30f380f6173736574446566696e6974696f6e010f69737375616e636550726f6772616d020a617267756d656e7473310a617267756d656e747332015e015cfad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92c30f03010c7370656e6450726f6772616d0973746174654461746117020a617267756d656e7473330a617267756d656e74733401010033a69849e11add96ac7053aad22ba2349a4abf5feb0475a0afcadff4e128be76cf92c30f0104747275650973746174654461746100",
-                               "07010001010b02096172626974726172790002010033ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92c30f0104747275650973746174654461746100010034ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92c30f010566616c73650973746174654461746100",
+                               "07018e0502012a00056e6f6e6365a69849e11add96ac7053aad22ba2349a4abf5feb0475a0afcadff4e128be76cf92c30f380f6173736574446566696e6974696f6e010f69737375616e636550726f6772616d020a617267756d656e7473310a617267756d656e747332015f015dfad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92c30f03010c7370656e6450726f6772616d010973746174654461746117020a617267756d656e7473330a617267756d656e74733401010034a69849e11add96ac7053aad22ba2349a4abf5feb0475a0afcadff4e128be76cf92c30f010474727565010973746174654461746100",
+                               "07010001010b02096172626974726172790002010034ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92c30f010474727565010973746174654461746100010035ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92c30f010566616c7365010973746174654461746100",
                        }, ""),
                        hash: testutil.MustDecodeHash("6076fc8a96b08a4842f4bdc805606e9775ce6dbe4e371e88c70b75ea4283e942"),
                },
index 078e596..6f0b2b5 100644 (file)
@@ -2,6 +2,7 @@ package types
 
 import (
        "bytes"
+       "reflect"
        "testing"
 
        "github.com/davecgh/go-spew/spew"
@@ -15,10 +16,10 @@ func TestMapSpendTx(t *testing.T) {
        cases := []*TxData{
                &TxData{
                        Inputs: []*TxInput{
-                               NewSpendInput(nil, testutil.MustDecodeHash("fad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409"), *consensus.BTMAssetID, 88, 3, []byte{1}, []byte{2}),
+                               NewSpendInput(nil, testutil.MustDecodeHash("fad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409"), *consensus.BTMAssetID, 88, 3, []byte{1}, [][]byte{[]byte{2}}),
                        },
                        Outputs: []*TxOutput{
-                               NewOriginalTxOutput(*consensus.BTMAssetID, 80, []byte{1}, []byte{2}),
+                               NewOriginalTxOutput(*consensus.BTMAssetID, 80, []byte{1}, [][]byte{[]byte{2}}),
                        },
                },
                &TxData{
@@ -26,17 +27,17 @@ func TestMapSpendTx(t *testing.T) {
                                NewIssuanceInput([]byte("nonce"), 254354, []byte("issuanceProgram"), [][]byte{[]byte("arguments1"), []byte("arguments2")}, []byte("assetDefinition")),
                        },
                        Outputs: []*TxOutput{
-                               NewOriginalTxOutput(*consensus.BTMAssetID, 80, []byte{1}, []byte{2}),
+                               NewOriginalTxOutput(*consensus.BTMAssetID, 80, []byte{1}, [][]byte{[]byte{2}}),
                        },
                },
                &TxData{
                        Inputs: []*TxInput{
                                NewIssuanceInput([]byte("nonce"), 254354, []byte("issuanceProgram"), [][]byte{[]byte("arguments1"), []byte("arguments2")}, []byte("assetDefinition")),
-                               NewSpendInput(nil, testutil.MustDecodeHash("db7b16ac737440d6e38559996ddabb207d7ce84fbd6f3bfd2525d234761dc863"), *consensus.BTMAssetID, 88, 3, []byte{1}, []byte{2}),
+                               NewSpendInput(nil, testutil.MustDecodeHash("db7b16ac737440d6e38559996ddabb207d7ce84fbd6f3bfd2525d234761dc863"), *consensus.BTMAssetID, 88, 3, []byte{1}, [][]byte{[]byte{2}}),
                        },
                        Outputs: []*TxOutput{
-                               NewOriginalTxOutput(*consensus.BTMAssetID, 80, []byte{1}, []byte{2}),
-                               NewOriginalTxOutput(*consensus.BTMAssetID, 80, []byte{1}, []byte{2}),
+                               NewOriginalTxOutput(*consensus.BTMAssetID, 80, []byte{1}, [][]byte{[]byte{2}}),
+                               NewOriginalTxOutput(*consensus.BTMAssetID, 80, []byte{1}, [][]byte{[]byte{2}}),
                        },
                },
        }
@@ -89,7 +90,7 @@ func TestMapSpendTx(t *testing.T) {
                        if !bytes.Equal(newOut.ControlProgram.Code, oldOut.ControlProgram) {
                                t.Errorf("header.ResultIds[%d].(*output).ControlProgram.Code is %x, expected %x", i, newOut.ControlProgram.Code, oldOut.ControlProgram)
                        }
-                       if !bytes.Equal(newOut.StateData.StateData, oldOut.StateData) {
+                       if !reflect.DeepEqual(newOut.StateData.StateData, oldOut.StateData) {
                                t.Errorf("header.ResultIds[%d].(*output).StateData.StateData is %x, expected %x", i, newOut.StateData.StateData, oldOut.StateData)
                        }
 
@@ -103,7 +104,7 @@ func TestMapCoinbaseTx(t *testing.T) {
                        NewCoinbaseInput([]byte("TestMapCoinbaseTx")),
                },
                Outputs: []*TxOutput{
-                       NewOriginalTxOutput(*consensus.BTMAssetID, 800000000000, []byte{1}, []byte{2}),
+                       NewOriginalTxOutput(*consensus.BTMAssetID, 800000000000, []byte{1}, [][]byte{[]byte{2}}),
                },
        }
        oldOut := txData.Outputs[0]
index b4ffeab..37385cb 100644 (file)
@@ -14,7 +14,7 @@ func (o *originalTxOutput) readFrom(*blockchain.Reader) error { return nil }
 func (o *originalTxOutput) writeTo(io.Writer) error           { return nil }
 
 // NewOriginalTxOutput create a new original output struct
-func NewOriginalTxOutput(assetID bc.AssetID, amount uint64, controlProgram []byte, stateData []byte) *TxOutput {
+func NewOriginalTxOutput(assetID bc.AssetID, amount uint64, controlProgram []byte, stateData [][]byte) *TxOutput {
        return &TxOutput{
                AssetVersion: 1,
                OutputCommitment: OutputCommitment{
index c157691..907b132 100644 (file)
@@ -14,7 +14,7 @@ type OutputCommitment struct {
        bc.AssetAmount
        VMVersion      uint64
        ControlProgram []byte
-       StateData      []byte
+       StateData      [][]byte
 }
 
 func (oc *OutputCommitment) writeTo(w io.Writer, assetVersion uint64) (err error) {
@@ -28,7 +28,7 @@ func (oc *OutputCommitment) writeTo(w io.Writer, assetVersion uint64) (err error
                if _, err = blockchain.WriteVarstr31(w, oc.ControlProgram); err != nil {
                        return errors.Wrap(err, "writing control program")
                }
-               if _, err = blockchain.WriteVarstr31(w, oc.StateData); err != nil {
+               if _, err = blockchain.WriteVarstrList(w, oc.StateData); err != nil {
                        return errors.Wrap(err, "writing state data")
                }
        }
@@ -51,7 +51,7 @@ func (oc *OutputCommitment) readFrom(r *blockchain.Reader, assetVersion uint64)
                if err != nil {
                        return errors.Wrap(err, "reading control program")
                }
-               oc.StateData, err = blockchain.ReadVarstr31(r)
+               oc.StateData, err = blockchain.ReadVarstrList(r)
                return errors.Wrap(err, "reading state data")
        }
        return nil
index 4e6be83..b17a676 100644 (file)
@@ -21,18 +21,18 @@ func TestReadWriteOutputCommitment(t *testing.T) {
                                AssetAmount:    bc.AssetAmount{AssetId: &btmAssetID, Amount: 100},
                                VMVersion:      1,
                                ControlProgram: testutil.MustDecodeHexString("00140876db6ca8f4542a836f0edd42b87d095d081182"),
-                               StateData:      []byte("stateData1"),
+                               StateData:      [][]byte{[]byte("stateData1")},
                        },
-                       encodeString: "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff64011600140876db6ca8f4542a836f0edd42b87d095d0811820a73746174654461746131",
+                       encodeString: "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff64011600140876db6ca8f4542a836f0edd42b87d095d081182010a73746174654461746131",
                },
                {
                        oc: &OutputCommitment{
                                AssetAmount:    bc.AssetAmount{AssetId: &btmAssetID, Amount: 50},
                                VMVersion:      1,
                                ControlProgram: testutil.MustDecodeHexString("00148bf7800b2333afd8414d6e903d58c4908b9bbcc7"),
-                               StateData:      []byte("stateData2"),
+                               StateData:      [][]byte{[]byte("stateData2")},
                        },
-                       encodeString: "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff32011600148bf7800b2333afd8414d6e903d58c4908b9bbcc70a73746174654461746132",
+                       encodeString: "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff32011600148bf7800b2333afd8414d6e903d58c4908b9bbcc7010a73746174654461746132",
                },
        }
 
index 3f83b77..de39d37 100644 (file)
@@ -12,7 +12,7 @@ type SpendInput struct {
 }
 
 // NewSpendInput create a new SpendInput struct.
-func NewSpendInput(arguments [][]byte, sourceID bc.Hash, assetID bc.AssetID, amount, sourcePos uint64, controlProgram []byte, stateData []byte) *TxInput {
+func NewSpendInput(arguments [][]byte, sourceID bc.Hash, assetID bc.AssetID, amount, sourcePos uint64, controlProgram []byte, stateData [][]byte) *TxInput {
        sc := SpendCommitment{
                AssetAmount: bc.AssetAmount{
                        AssetId: &assetID,
index 46b348e..8fe1d4f 100644 (file)
@@ -16,7 +16,7 @@ type SpendCommitment struct {
        SourcePosition uint64
        VMVersion      uint64
        ControlProgram []byte
-       StateData      []byte
+       StateData      [][]byte
 }
 
 func (sc *SpendCommitment) writeExtensibleString(w io.Writer, suffix []byte, assetVersion uint64) error {
@@ -43,7 +43,7 @@ func (sc *SpendCommitment) writeContents(w io.Writer, suffix []byte, assetVersio
                if _, err = blockchain.WriteVarstr31(w, sc.ControlProgram); err != nil {
                        return errors.Wrap(err, "writing control program")
                }
-               if _, err = blockchain.WriteVarstr31(w, sc.StateData); err != nil {
+               if _, err = blockchain.WriteVarstrList(w, sc.StateData); err != nil {
                        return errors.Wrap(err, "writing state data")
                }
        }
@@ -74,7 +74,7 @@ func (sc *SpendCommitment) readFrom(r *blockchain.Reader, assetVersion uint64) (
                        if sc.ControlProgram, err = blockchain.ReadVarstr31(r); err != nil {
                                return errors.Wrap(err, "reading control program")
                        }
-                       if sc.StateData, err = blockchain.ReadVarstr31(r); err != nil {
+                       if sc.StateData, err = blockchain.ReadVarstrList(r); err != nil {
                                return errors.Wrap(err, "reading state data")
                        }
                        return nil
index bd8af5f..f203fb2 100644 (file)
@@ -26,9 +26,9 @@ func TestReadWriteSpendCommitment(t *testing.T) {
                                SourcePosition: 0,
                                VMVersion:      1,
                                ControlProgram: testutil.MustDecodeHexString("0014d927424f4e8c242460b538f04c2676b97842e9a7"),
-                               StateData:      testutil.MustDecodeHexString("1234abcd"),
+                               StateData:      [][]byte{testutil.MustDecodeHexString("1234abcd")},
                        },
-                       encodeString: "5f3160fb24f97e06ad5a9717cd47fe2b65c7409903216b39120b10550282b20e99ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff640001160014d927424f4e8c242460b538f04c2676b97842e9a7041234abcd",
+                       encodeString: "603160fb24f97e06ad5a9717cd47fe2b65c7409903216b39120b10550282b20e99ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff640001160014d927424f4e8c242460b538f04c2676b97842e9a701041234abcd",
                },
                {
                        sc: &SpendCommitment{
@@ -40,9 +40,9 @@ func TestReadWriteSpendCommitment(t *testing.T) {
                                SourcePosition: 2,
                                VMVersion:      1,
                                ControlProgram: testutil.MustDecodeHexString("001418549d84daf53344d32563830c7cf979dc19d5c0"),
-                               StateData:      testutil.MustDecodeHexString("123456abcdef"),
+                               StateData:      [][]byte{testutil.MustDecodeHexString("123456abcdef")},
                        },
-                       encodeString: "624b5cb973f5bef4eadde4c89b92ee73312b940e84164da0594149554cc8a2adeaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe707020116001418549d84daf53344d32563830c7cf979dc19d5c006123456abcdef",
+                       encodeString: "634b5cb973f5bef4eadde4c89b92ee73312b940e84164da0594149554cc8a2adeaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe707020116001418549d84daf53344d32563830c7cf979dc19d5c00106123456abcdef",
                },
        }
 
index 3df8e7a..6430cfb 100644 (file)
@@ -24,11 +24,11 @@ func TestSerializationSpendCommitment(t *testing.T) {
                SourcePosition: 3,
                VMVersion:      1,
                ControlProgram: []byte("TestSerializationSpendCommitment"),
-               StateData:      []byte("TestStateData"),
+               StateData:      [][]byte{[]byte("TestStateData")},
        }
 
        wantHex := strings.Join([]string{
-               "74", // serialization length
+               "75", // serialization length
                "bef8ff450b877df84174ac5c279fc97da0f507ffe7beef7badf116ea9e2ff041", // sourceID
                "81756fdab39a17163b0ce582ee4ee256fb4d1e156c692b997d608a42ecb38d47", // assetID
                "92c30f", // amount
@@ -36,7 +36,7 @@ func TestSerializationSpendCommitment(t *testing.T) {
                "01",     // version
                "20",     // control program length
                "5465737453657269616c697a6174696f6e5370656e64436f6d6d69746d656e74", // control program
-               "0d",                         // stata data length
+               "010d",                       // stata data length
                "54657374537461746544617461", // state data
        }, "")
 
index 593ca5b..26c434b 100644 (file)
@@ -41,14 +41,14 @@ func TestTransaction(t *testing.T) {
                {
                        tx: NewTx(TxData{
                                Version:        1,
-                               SerializedSize: uint64(282),
+                               SerializedSize: uint64(284),
                                TimeRange:      654,
                                Inputs: []*TxInput{
                                        NewIssuanceInput([]byte("nonce"), 254354, []byte("issuanceProgram"), [][]byte{[]byte("arguments1"), []byte("arguments2")}, []byte("assetDefinition")),
-                                       NewSpendInput([][]byte{[]byte("arguments3"), []byte("arguments4")}, testutil.MustDecodeHash("fad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409"), *consensus.BTMAssetID, 254354, 3, []byte("spendProgram"), []byte("stateData")),
+                                       NewSpendInput([][]byte{[]byte("arguments3"), []byte("arguments4")}, testutil.MustDecodeHash("fad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409"), *consensus.BTMAssetID, 254354, 3, []byte("spendProgram"), [][]byte{[]byte("stateData")}),
                                },
                                Outputs: []*TxOutput{
-                                       NewOriginalTxOutput(testutil.MustDecodeAsset("a69849e11add96ac7053aad22ba2349a4abf5feb0475a0afcadff4e128be76cf"), 254354, []byte("true"), []byte("stateData")),
+                                       NewOriginalTxOutput(testutil.MustDecodeAsset("a69849e11add96ac7053aad22ba2349a4abf5feb0475a0afcadff4e128be76cf"), 254354, []byte("true"), [][]byte{[]byte("stateData")}),
                                },
                        }),
                        hex: strings.Join([]string{
@@ -75,9 +75,9 @@ func TestTransaction(t *testing.T) {
                                "0a",                             // input 0: second argument length
                                "617267756d656e747332",           // input 0: second argument data
                                "01",                             // input 1: asset version
-                               "5e",                             // input 1: input commitment length
+                               "5f",                             // input 1: input commitment length
                                "01",                             // input 1: spend type flag
-                               "5c",                             // input 1: spend commitment length
+                               "5d",                             // input 1: spend commitment length
                                "fad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409", // input 1: source id
                                "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", // input 1: assetID
                                "92c30f",                   // input 1: amount
@@ -85,7 +85,7 @@ func TestTransaction(t *testing.T) {
                                "01",                       // input 1: vm version
                                "0c",                       // input 1: spend program length
                                "7370656e6450726f6772616d", // input 1: spend program
-                               "09",                       // input 1: state data length
+                               "0109",                     // input 1: state data length
                                "737461746544617461",       // input 1: state data
                                "17",                       // input 1: witness length
                                "02",                       // input 1: argument array length
@@ -96,28 +96,28 @@ func TestTransaction(t *testing.T) {
                                "01",                       // outputs count
                                "01",                       // output 0: asset version
                                "00",
-                               "33", // output 0: serialization length
+                               "34", // output 0: serialization length
                                "a69849e11add96ac7053aad22ba2349a4abf5feb0475a0afcadff4e128be76cf", // output 0: assetID
                                "92c30f",             // output 0: amount
                                "01",                 // output 0: version
                                "04",                 // output 0: control program length
                                "74727565",           // output 0: control program
-                               "09",                 // output 0: state data length
+                               "0109",               // output 0: state data length
                                "737461746544617461", // output 0: state data
                                "00",                 // output 0: witness length
                        }, ""),
-                       hash: testutil.MustDecodeHash("99a5bb58af6aada96e415a22c6c71df8bad25b0ad5a3c27f6f9c8f9b3b42df60"),
+                       hash: testutil.MustDecodeHash("b23862d7969ce9581ee7f94f648fd8a51ca103984afb68a134db9ab5c3af177f"),
                },
                {
                        tx: NewTx(TxData{
                                Version:        1,
-                               SerializedSize: uint64(130),
+                               SerializedSize: uint64(132),
                                Inputs: []*TxInput{
                                        NewCoinbaseInput([]byte("arbitrary")),
                                },
                                Outputs: []*TxOutput{
-                                       NewOriginalTxOutput(*consensus.BTMAssetID, 254354, []byte("true"), []byte("stateData")),
-                                       NewOriginalTxOutput(*consensus.BTMAssetID, 254354, []byte("false"), []byte("stateData")),
+                                       NewOriginalTxOutput(*consensus.BTMAssetID, 254354, []byte("true"), [][]byte{[]byte("stateData")}),
+                                       NewOriginalTxOutput(*consensus.BTMAssetID, 254354, []byte("false"), [][]byte{[]byte("stateData")}),
                                },
                        }),
                        hex: strings.Join([]string{
@@ -134,28 +134,28 @@ func TestTransaction(t *testing.T) {
                                "02",                 // outputs count
                                "01",                 // output 0: asset version
                                "00",
-                               "33", // output 0: serialization length
+                               "34", // output 0: serialization length
                                "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", // output 0: assetID
                                "92c30f",             // output 0: amount
                                "01",                 // output 0: version
                                "04",                 // output 0: control program length
                                "74727565",           // output 0: control program
-                               "09",                 // output 0: state data length
+                               "0109",               // output 0: state data length
                                "737461746544617461", // output 0: state data
                                "00",                 // output 0: witness length
                                "01",                 // output 1: asset version
                                "00",
-                               "34", // output 1: serialization length
+                               "35", // output 1: serialization length
                                "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", // output 1: assetID
                                "92c30f",             // output 1: amount
                                "01",                 // output 1: version
                                "05",                 // output 1: control program length
                                "66616c7365",         // output 1: control program
-                               "09",                 // output 0: state data length
+                               "0109",               // output 0: state data length
                                "737461746544617461", // output 0: state data
                                "00",                 // output 1: witness length
                        }, ""),
-                       hash: testutil.MustDecodeHash("c64bc6d935436156e6da9592ff8e8e29e8fd93af5ed0447de822361112997cf5"),
+                       hash: testutil.MustDecodeHash("9f0ca64c282b7069c67af78e989a14ed8d208aa99222370d941dad4bbf69cb2c"),
                },
        }
        for i, test := range cases {
index a830293..277bbeb 100644 (file)
@@ -72,13 +72,13 @@ func TestSerializationSpend(t *testing.T) {
                []byte("arguments1"),
                []byte("arguments2"),
        }
-       spend := NewSpendInput(arguments, testutil.MustDecodeHash("fad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409"), testutil.MustDecodeAsset("fe9791d71b67ee62515e08723c061b5ccb952a80d804417c8aeedf7f633c524a"), 254354, 3, []byte("spendProgram"), []byte("stateData"))
+       spend := NewSpendInput(arguments, testutil.MustDecodeHash("fad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409"), testutil.MustDecodeAsset("fe9791d71b67ee62515e08723c061b5ccb952a80d804417c8aeedf7f633c524a"), 254354, 3, []byte("spendProgram"), [][]byte{[]byte("stateData")})
 
        wantHex := strings.Join([]string{
                "01", // asset version
-               "5e", // input commitment length
+               "5f", // input commitment length
                "01", // spend type flag
-               "5c", // spend commitment length
+               "5d", // spend commitment length
                "fad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409", // source id
                "fe9791d71b67ee62515e08723c061b5ccb952a80d804417c8aeedf7f633c524a", // assetID
                "92c30f",                   // amount
@@ -86,7 +86,7 @@ func TestSerializationSpend(t *testing.T) {
                "01",                       // vm version
                "0c",                       // spend program length
                "7370656e6450726f6772616d", // spend program
-               "09",                       // state length
+               "0109",                     // state length
                "737461746544617461",       // state
                "17",                       // witness length
                "02",                       // argument array length
@@ -167,7 +167,7 @@ func TestSerializationVeto(t *testing.T) {
                []byte("arguments2"),
        }
 
-       vetoInput := NewVetoInput(arguments, testutil.MustDecodeHash("fad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409"), testutil.MustDecodeAsset("fe9791d71b67ee62515e08723c061b5ccb952a80d804417c8aeedf7f633c524a"), 254354, 3, []byte("spendProgram"), []byte("af594006a40837d9f028daabb6d589df0b9138daefad5683e5233c2646279217294a8d532e60863bcf196625a35fb8ceeffa3c09610eb92dcfb655a947f13269"), []byte{})
+       vetoInput := NewVetoInput(arguments, testutil.MustDecodeHash("fad5195a0c8e3b590b86a3c0a95e7529565888508aecca96e9aeda633002f409"), testutil.MustDecodeAsset("fe9791d71b67ee62515e08723c061b5ccb952a80d804417c8aeedf7f633c524a"), 254354, 3, []byte("spendProgram"), []byte("af594006a40837d9f028daabb6d589df0b9138daefad5683e5233c2646279217294a8d532e60863bcf196625a35fb8ceeffa3c09610eb92dcfb655a947f13269"), [][]byte{})
 
        wantHex := strings.Join([]string{
                "01",   // asset version
index b1cfe96..742dcdc 100644 (file)
@@ -15,18 +15,18 @@ import (
 
 func TestSerializationOriginalTxOutput(t *testing.T) {
        assetID := testutil.MustDecodeAsset("81756fdab39a17163b0ce582ee4ee256fb4d1e156c692b997d608a42ecb38d47")
-       txOutput := NewOriginalTxOutput(assetID, 254354, []byte("TestSerializationTxOutput"), []byte("stateData"))
+       txOutput := NewOriginalTxOutput(assetID, 254354, []byte("TestSerializationTxOutput"), [][]byte{[]byte("stateData")})
 
        wantHex := strings.Join([]string{
                "01", // asset version
                "00", // output type
-               "48", // serialization length
+               "49", // serialization length
                "81756fdab39a17163b0ce582ee4ee256fb4d1e156c692b997d608a42ecb38d47", // assetID
                "92c30f", // amount
                "01",     // version
                "19",     // control program length
                "5465737453657269616c697a6174696f6e54784f7574707574", // control program
-               "09",                 // state data length
+               "0109",               // state data length
                "737461746544617461", // state data
                "00",                 // witness length
        }, "")
@@ -60,12 +60,12 @@ func TestSerializationOriginalTxOutput(t *testing.T) {
 
 func TestSerializationVoteOutput(t *testing.T) {
        assetID := testutil.MustDecodeAsset("81756fdab39a17163b0ce582ee4ee256fb4d1e156c692b997d608a42ecb38d47")
-       voteTxOutput := NewVoteOutput(assetID, 1000, []byte("TestSerializationTxOutput"), []byte("af594006a40837d9f028daabb6d589df0b9138daefad5683e5233c2646279217294a8d532e60863bcf196625a35fb8ceeffa3c09610eb92dcfb655a947f13269"), []byte("stateData"))
+       voteTxOutput := NewVoteOutput(assetID, 1000, []byte("TestSerializationTxOutput"), []byte("af594006a40837d9f028daabb6d589df0b9138daefad5683e5233c2646279217294a8d532e60863bcf196625a35fb8ceeffa3c09610eb92dcfb655a947f13269"), [][]byte{[]byte("stateData")})
 
        wantHex := strings.Join([]string{
                "01",   // asset version
                "01",   // outType
-               "c901", // serialization length
+               "ca01", // serialization length
                "8001", // output xpub length
                "6166353934303036613430383337643966303238646161626236643538396466306239313338646165666164353638336535323333633236343632373932313732393461386435333265363038363362636631393636323561333566623863656566666133633039363130656239326463666236353561393437663133323639", // xpub
                "81756fdab39a17163b0ce582ee4ee256fb4d1e156c692b997d608a42ecb38d47", // assetID
@@ -73,7 +73,7 @@ func TestSerializationVoteOutput(t *testing.T) {
                "01",   // version
                "19",   // control program length
                "5465737453657269616c697a6174696f6e54784f7574707574", // control program
-               "09",                 // state data length
+               "0109",               // state data length
                "737461746544617461", // state datas
                "00",                 // witness length
        }, "")
index 03b1f7b..25a2520 100644 (file)
@@ -13,7 +13,7 @@ type VetoInput struct {
 }
 
 // NewVetoInput create a new VetoInput struct.
-func NewVetoInput(arguments [][]byte, sourceID bc.Hash, assetID bc.AssetID, amount, sourcePos uint64, controlProgram []byte, vote []byte, stateData []byte) *TxInput {
+func NewVetoInput(arguments [][]byte, sourceID bc.Hash, assetID bc.AssetID, amount, sourcePos uint64, controlProgram []byte, vote []byte, stateData [][]byte) *TxInput {
        sc := SpendCommitment{
                AssetAmount: bc.AssetAmount{
                        AssetId: &assetID,
index 678d2f4..18d2cbd 100644 (file)
@@ -14,7 +14,7 @@ type VoteOutput struct {
 }
 
 // NewVoteOutput create a new output struct
-func NewVoteOutput(assetID bc.AssetID, amount uint64, controlProgram []byte, vote []byte, state []byte) *TxOutput {
+func NewVoteOutput(assetID bc.AssetID, amount uint64, controlProgram []byte, vote []byte, state [][]byte) *TxOutput {
        return &TxOutput{
                AssetVersion: 1,
                OutputCommitment: OutputCommitment{
index 740003b..64e954d 100644 (file)
@@ -29,10 +29,10 @@ func TestValidateTx(t *testing.T) {
                                                        mustDecodeString("32fa23244a69e5524d190ad62391c2fc654685a740e00e9a316b78c95028363f"),
                                                },
                                                bc.Hash{V0: 2},
-                                               *consensus.BTMAssetID, 1000000000, 0, mustDecodeString("00149dd32abe4756676cc310470457edefce8b3bd7e7"), []byte{}),
+                                               *consensus.BTMAssetID, 1000000000, 0, mustDecodeString("00149dd32abe4756676cc310470457edefce8b3bd7e7"), [][]byte{}),
                                },
                                Outputs: []*types.TxOutput{
-                                       types.NewOriginalTxOutput(*consensus.BTMAssetID, 100, mustDecodeString("00149dd32abe4756676cc310470457edefce8b3bd7e7"), []byte{}),
+                                       types.NewOriginalTxOutput(*consensus.BTMAssetID, 100, mustDecodeString("00149dd32abe4756676cc310470457edefce8b3bd7e7"), [][]byte{}),
                                },
                        },
                        err: nil,
@@ -150,7 +150,7 @@ func TestValidateTx(t *testing.T) {
                                                        mustDecodeString("7642ba797fd89d1f98a8559b4ca74123697dd4dee882955acd0da9010a80d64e"),
                                                },
                                                bc.Hash{V0: 14760873410800997144, V1: 1698395500822741684, V2: 5965908492734661392, V3: 9445539829830863994},
-                                               *consensus.BTMAssetID, 11818900000, 0, mustDecodeString("0014f233267911e94dc74df706fe3b697273e212d545"), []byte{}),
+                                               *consensus.BTMAssetID, 11818900000, 0, mustDecodeString("0014f233267911e94dc74df706fe3b697273e212d545"), [][]byte{}),
                                        types.NewIssuanceInput(
                                                mustDecodeString("fd0aec4229deb281"),
                                                10000000000,
index c72f4fa..41a3ccf 100644 (file)
@@ -52,7 +52,7 @@ func init() {
                                                                types.NewCoinbaseInput(testutil.MustDecodeHexString("0031")),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41250000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41250000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                        },
@@ -76,7 +76,7 @@ func init() {
                                                                types.NewCoinbaseInput(testutil.MustDecodeHexString("0031")),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41250000000, testutil.MustDecodeHexString("00143d05e891b165b165afefa2e861e83a9745f80d8c"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41250000000, testutil.MustDecodeHexString("00143d05e891b165b165afefa2e861e83a9745f80d8c"), [][]byte{}),
                                                        },
                                                }),
                                        },
@@ -103,7 +103,7 @@ func init() {
                                                                types.NewCoinbaseInput(testutil.MustDecodeHexString("0032")),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41250000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41250000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                        },
@@ -128,7 +128,7 @@ func init() {
                                                                types.NewCoinbaseInput(testutil.MustDecodeHexString("0032")),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41350000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41350000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                                types.NewTx(types.TxData{
@@ -143,11 +143,11 @@ func init() {
                                                                        testutil.MustDecodeHash("28b7b53d8dc90006bf97e0a4eaae2a72ec3d869873188698b694beaf20789f21"),
                                                                        *consensus.BTMAssetID, 10000000000, 0,
                                                                        testutil.MustDecodeHexString("0014cade6dd7cbe2ea2b8ab90dfb8756dda4ba1624bc"),
-                                                                       []byte{},
+                                                                       [][]byte{},
                                                                ),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 9900000000, testutil.MustDecodeHexString("00143d05e891b165b165afefa2e861e83a9745f80d8c"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 9900000000, testutil.MustDecodeHexString("00143d05e891b165b165afefa2e861e83a9745f80d8c"), [][]byte{}),
                                                        },
                                                }),
                                        },
@@ -172,7 +172,7 @@ func init() {
                                                                types.NewCoinbaseInput(testutil.MustDecodeHexString("0032")),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41350000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41350000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                                types.NewTx(types.TxData{
@@ -187,11 +187,11 @@ func init() {
                                                                        testutil.MustDecodeHash("28b7b53d8dc90006bf97e0a4eaae2a72ec3d869873188698b694beaf20789f21"),
                                                                        *consensus.BTMAssetID, 10000000000, 0,
                                                                        testutil.MustDecodeHexString("0014cade6dd7cbe2ea2b8ab90dfb8756dda4ba1624bc"),
-                                                                       []byte{},
+                                                                       [][]byte{},
                                                                ),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 9900000000, testutil.MustDecodeHexString("6a"), []byte{}), // retire
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 9900000000, testutil.MustDecodeHexString("6a"), [][]byte{}), // retire
                                                        },
                                                }),
                                        },
@@ -216,7 +216,7 @@ func init() {
                                                                types.NewCoinbaseInput(testutil.MustDecodeHexString("0032")),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41350000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41350000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                                types.NewTx(types.TxData{
@@ -231,7 +231,7 @@ func init() {
                                                                        testutil.MustDecodeHash("28b7b53d8dc90006bf97e0a4eaae2a72ec3d869873188698b694beaf20789f21"),
                                                                        *consensus.BTMAssetID, 10000000000, 0,
                                                                        testutil.MustDecodeHexString("0014cade6dd7cbe2ea2b8ab90dfb8756dda4ba1624bc"),
-                                                                       []byte{},
+                                                                       [][]byte{},
                                                                ),
                                                                types.NewIssuanceInput(
                                                                        testutil.MustDecodeHexString("fd0aec4229deb281"),
@@ -242,8 +242,8 @@ func init() {
                                                                ),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 9900000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
-                                                               types.NewOriginalTxOutput(testutil.MustDecodeAsset("641ccb49dd38df9921a55e020d40a2323589c36ab5557f8a249ee01cc09d1836"), 10000000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 9900000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
+                                                               types.NewOriginalTxOutput(testutil.MustDecodeAsset("641ccb49dd38df9921a55e020d40a2323589c36ab5557f8a249ee01cc09d1836"), 10000000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                        },
@@ -268,7 +268,7 @@ func init() {
                                                                types.NewCoinbaseInput(testutil.MustDecodeHexString("0032")),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41350000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41350000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                                types.NewTx(types.TxData{
@@ -283,7 +283,7 @@ func init() {
                                                                        testutil.MustDecodeHash("28b7b53d8dc90006bf97e0a4eaae2a72ec3d869873188698b694beaf20789f21"),
                                                                        *consensus.BTMAssetID, 10000000000, 0,
                                                                        testutil.MustDecodeHexString("0014cade6dd7cbe2ea2b8ab90dfb8756dda4ba1624bc"),
-                                                                       []byte{},
+                                                                       [][]byte{},
                                                                ),
                                                                types.NewIssuanceInput(
                                                                        testutil.MustDecodeHexString("fd0aec4229deb281"),
@@ -295,8 +295,8 @@ func init() {
                                                                ),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 9900000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
-                                                               types.NewOriginalTxOutput(testutil.MustDecodeAsset("641ccb49dd38df9921a55e020d40a2323589c36ab5557f8a249ee01cc09d1836"), 10000000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 9900000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
+                                                               types.NewOriginalTxOutput(testutil.MustDecodeAsset("641ccb49dd38df9921a55e020d40a2323589c36ab5557f8a249ee01cc09d1836"), 10000000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                        },
@@ -322,7 +322,7 @@ func init() {
                                                                types.NewCoinbaseInput(testutil.MustDecodeHexString("0032")),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41350000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41350000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                                types.NewTx(types.TxData{
@@ -337,7 +337,7 @@ func init() {
                                                                        testutil.MustDecodeHash("28b7b53d8dc90006bf97e0a4eaae2a72ec3d869873188698b694beaf20789f21"),
                                                                        *consensus.BTMAssetID, 10000000000, 0,
                                                                        testutil.MustDecodeHexString("0014cade6dd7cbe2ea2b8ab90dfb8756dda4ba1624bc"),
-                                                                       []byte{},
+                                                                       [][]byte{},
                                                                ),
                                                                types.NewSpendInput(
                                                                        [][]byte{
@@ -347,12 +347,12 @@ func init() {
                                                                        testutil.MustDecodeHash("28b7b53d8dc90006bf97e0a4eaae2a72ec3d869873188698b694beaf20789f22"),
                                                                        testutil.MustDecodeAsset("641ccb49dd38df9921a55e020d40a2323589c36ab5557f8a249ee01cc09d1836"), 10000000000, 1,
                                                                        testutil.MustDecodeHexString("0014cade6dd7cbe2ea2b8ab90dfb8756dda4ba1624bc"),
-                                                                       []byte{},
+                                                                       [][]byte{},
                                                                ),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 9900000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
-                                                               types.NewOriginalTxOutput(testutil.MustDecodeAsset("641ccb49dd38df9921a55e020d40a2323589c36ab5557f8a249ee01cc09d1836"), 10000000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 9900000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
+                                                               types.NewOriginalTxOutput(testutil.MustDecodeAsset("641ccb49dd38df9921a55e020d40a2323589c36ab5557f8a249ee01cc09d1836"), 10000000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                        },
@@ -377,7 +377,7 @@ func init() {
                                                                types.NewCoinbaseInput(testutil.MustDecodeHexString("0032")),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41350000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41350000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                                types.NewTx(types.TxData{
@@ -392,7 +392,7 @@ func init() {
                                                                        testutil.MustDecodeHash("28b7b53d8dc90006bf97e0a4eaae2a72ec3d869873188698b694beaf20789f21"),
                                                                        *consensus.BTMAssetID, 10000000000, 0,
                                                                        testutil.MustDecodeHexString("0014cade6dd7cbe2ea2b8ab90dfb8756dda4ba1624bc"),
-                                                                       []byte{},
+                                                                       [][]byte{},
                                                                ),
                                                                types.NewSpendInput(
                                                                        // invalid signature
@@ -403,12 +403,12 @@ func init() {
                                                                        testutil.MustDecodeHash("28b7b53d8dc90006bf97e0a4eaae2a72ec3d869873188698b694beaf20789f22"),
                                                                        testutil.MustDecodeAsset("641ccb49dd38df9921a55e020d40a2323589c36ab5557f8a249ee01cc09d1836"), 10000000000, 1,
                                                                        testutil.MustDecodeHexString("0014cade6dd7cbe2ea2b8ab90dfb8756dda4ba1624bc"),
-                                                                       []byte{},
+                                                                       [][]byte{},
                                                                ),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 9900000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
-                                                               types.NewOriginalTxOutput(testutil.MustDecodeAsset("641ccb49dd38df9921a55e020d40a2323589c36ab5557f8a249ee01cc09d1836"), 10000000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 9900000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
+                                                               types.NewOriginalTxOutput(testutil.MustDecodeAsset("641ccb49dd38df9921a55e020d40a2323589c36ab5557f8a249ee01cc09d1836"), 10000000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                        },
@@ -435,7 +435,7 @@ func init() {
                                                                types.NewCoinbaseInput(testutil.MustDecodeHexString("0033")),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41250000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41250000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                        },
@@ -460,7 +460,7 @@ func init() {
                                                                types.NewCoinbaseInput(testutil.MustDecodeHexString("0033")),
                                                        },
                                                        Outputs: []*types.TxOutput{
-                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41250000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), []byte{}),
+                                                               types.NewOriginalTxOutput(*consensus.BTMAssetID, 41250000000, testutil.MustDecodeHexString("0014024bb9bfc639bdac292ff9ceb41b5c6f5a970eab"), [][]byte{}),
                                                        },
                                                }),
                                        },