From 0a09a20900721f5c88c7d5ec325d9caf7dd42f7d Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 5 Jun 2020 12:40:07 +0300 Subject: [PATCH] transaction: drop Register transaction type And everything associated like SystemFee configuration. --- cli/wallet/wallet.go | 13 ---- config/protocol.mainnet.yml | 2 - config/protocol.privnet.docker.four.yml | 2 - config/protocol.privnet.docker.one.yml | 2 - config/protocol.privnet.docker.single.yml | 2 - config/protocol.privnet.docker.three.yml | 2 - config/protocol.privnet.docker.two.yml | 2 - config/protocol.privnet.yml | 3 - config/protocol.testnet.yml | 2 - config/protocol.unit_testnet.yml | 2 - docs/cli.md | 2 - pkg/config/config.go | 3 - pkg/config/protocol_config.go | 25 ++----- pkg/core/blockchain.go | 29 -------- pkg/core/transaction/register.go | 82 ----------------------- pkg/core/transaction/register_test.go | 46 ------------- pkg/core/transaction/transaction.go | 29 +------- pkg/core/transaction/transaction_test.go | 31 --------- pkg/core/transaction/type.go | 5 -- pkg/core/util.go | 39 ----------- pkg/core/util_test.go | 16 ----- pkg/interop/transaction/transaction.go | 1 - 22 files changed, 5 insertions(+), 335 deletions(-) delete mode 100644 pkg/core/transaction/register.go delete mode 100644 pkg/core/transaction/register_test.go diff --git a/cli/wallet/wallet.go b/cli/wallet/wallet.go index 0c536888a..0e349c64a 100644 --- a/cli/wallet/wallet.go +++ b/cli/wallet/wallet.go @@ -11,7 +11,6 @@ import ( "syscall" "github.com/nspcc-dev/neo-go/cli/flags" - "github.com/nspcc-dev/neo-go/pkg/core" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neo-go/pkg/rpc/client" @@ -510,18 +509,6 @@ func openWallet(path string) (*wallet.Wallet, error) { return wallet.NewWalletFromFile(path) } -func getAssetID(s string) (util.Uint256, error) { - s = strings.ToLower(s) - switch { - case s == "neo": - return core.GoverningTokenID(), nil - case s == "gas": - return core.UtilityTokenID(), nil - default: - return util.Uint256DecodeStringLE(s) - } -} - func newAccountFromWIF(wif string) (*wallet.Account, error) { // note: NEP2 strings always have length of 58 even though // base58 strings can have different lengths even if slice lengths are equal diff --git a/config/protocol.mainnet.yml b/config/protocol.mainnet.yml index 9a7214920..861041637 100644 --- a/config/protocol.mainnet.yml +++ b/config/protocol.mainnet.yml @@ -18,8 +18,6 @@ ProtocolConfiguration: - seed3.neo.org:10333 - seed4.neo.org:10333 - seed5.neo.org:10333 - SystemFee: - RegisterTransaction: 10000 VerifyBlocks: true VerifyTransactions: false FreeGasLimit: 10.0 diff --git a/config/protocol.privnet.docker.four.yml b/config/protocol.privnet.docker.four.yml index b073338b9..e2fc0fefe 100644 --- a/config/protocol.privnet.docker.four.yml +++ b/config/protocol.privnet.docker.four.yml @@ -14,8 +14,6 @@ ProtocolConfiguration: - 172.200.0.2:20334 - 172.200.0.3:20335 - 172.200.0.4:20336 - SystemFee: - RegisterTransaction: 10000 VerifyBlocks: true VerifyTransactions: true diff --git a/config/protocol.privnet.docker.one.yml b/config/protocol.privnet.docker.one.yml index 984cb1f20..f60ca55ba 100644 --- a/config/protocol.privnet.docker.one.yml +++ b/config/protocol.privnet.docker.one.yml @@ -14,8 +14,6 @@ ProtocolConfiguration: - 172.200.0.2:20334 - 172.200.0.3:20335 - 172.200.0.4:20336 - SystemFee: - RegisterTransaction: 10000 VerifyBlocks: true VerifyTransactions: true diff --git a/config/protocol.privnet.docker.single.yml b/config/protocol.privnet.docker.single.yml index 67c947627..f43ffaeed 100644 --- a/config/protocol.privnet.docker.single.yml +++ b/config/protocol.privnet.docker.single.yml @@ -8,8 +8,6 @@ ProtocolConfiguration: - 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2 SeedList: - 172.200.0.1:20333 - SystemFee: - RegisterTransaction: 10000 VerifyBlocks: true VerifyTransactions: true diff --git a/config/protocol.privnet.docker.three.yml b/config/protocol.privnet.docker.three.yml index c0396b338..620ef90e9 100644 --- a/config/protocol.privnet.docker.three.yml +++ b/config/protocol.privnet.docker.three.yml @@ -14,8 +14,6 @@ ProtocolConfiguration: - 172.200.0.2:20334 - 172.200.0.3:20335 - 172.200.0.4:20336 - SystemFee: - RegisterTransaction: 10000 VerifyBlocks: true VerifyTransactions: true diff --git a/config/protocol.privnet.docker.two.yml b/config/protocol.privnet.docker.two.yml index 631b57d89..01f109416 100644 --- a/config/protocol.privnet.docker.two.yml +++ b/config/protocol.privnet.docker.two.yml @@ -14,8 +14,6 @@ ProtocolConfiguration: - 172.200.0.2:20334 - 172.200.0.3:20335 - 172.200.0.4:20336 - SystemFee: - RegisterTransaction: 10000 VerifyBlocks: true VerifyTransactions: true diff --git a/config/protocol.privnet.yml b/config/protocol.privnet.yml index fedfe23d5..e8a1d7185 100644 --- a/config/protocol.privnet.yml +++ b/config/protocol.privnet.yml @@ -14,9 +14,6 @@ ProtocolConfiguration: - 127.0.0.1:20334 - 127.0.0.1:20335 - 127.0.0.1:20336 - SystemFee: - EnrollmentTransaction: 1000 - RegisterTransaction: 10000 VerifyBlocks: true VerifyTransactions: true diff --git a/config/protocol.testnet.yml b/config/protocol.testnet.yml index 394479a81..785f3a429 100644 --- a/config/protocol.testnet.yml +++ b/config/protocol.testnet.yml @@ -18,8 +18,6 @@ ProtocolConfiguration: - seed3t.neo.org:20333 - seed4t.neo.org:20333 - seed5t.neo.org:20333 - SystemFee: - RegisterTransaction: 100 VerifyBlocks: true VerifyTransactions: false FreeGasLimit: 10.0 diff --git a/config/protocol.unit_testnet.yml b/config/protocol.unit_testnet.yml index 0df1905e0..e786558a7 100644 --- a/config/protocol.unit_testnet.yml +++ b/config/protocol.unit_testnet.yml @@ -13,8 +13,6 @@ ProtocolConfiguration: - 127.0.0.1:20334 - 127.0.0.1:20335 - 127.0.0.1:20336 - SystemFee: - RegisterTransaction: 10000 VerifyBlocks: true VerifyTransactions: true diff --git a/docs/cli.md b/docs/cli.md index b11471fb8..f199cbc3a 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -59,8 +59,6 @@ ProtocolConfiguration: - 127.0.0.1:20334 - 127.0.0.1:20335 - 127.0.0.1:20336 - SystemFee: - RegisterTransaction: 10000 ApplicationConfiguration: DataDirectoryPath: "./chains/privnet" diff --git a/pkg/config/config.go b/pkg/config/config.go index 999656ffb..f434191bd 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -40,9 +40,6 @@ func Load(path string, netMode NetMode) (Config, error) { } config := Config{ - ProtocolConfiguration: ProtocolConfiguration{ - SystemFee: SystemFee{}, - }, ApplicationConfiguration: ApplicationConfiguration{ PingInterval: 30, PingTimeout: 90, diff --git a/pkg/config/protocol_config.go b/pkg/config/protocol_config.go index fd6f163b8..94c5e452d 100644 --- a/pkg/config/protocol_config.go +++ b/pkg/config/protocol_config.go @@ -1,7 +1,6 @@ package config import ( - "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/util" ) @@ -34,22 +33,16 @@ type ( MaxFreeTransactionsPerBlock int `yaml:"MaxFreeTransactionsPerBlock"` MemPoolSize int `yaml:"MemPoolSize"` // SaveStorageBatch enables storage batch saving before every persist. - SaveStorageBatch bool `yaml:"SaveStorageBatch"` - SecondsPerBlock int `yaml:"SecondsPerBlock"` - SeedList []string `yaml:"SeedList"` - StandbyValidators []string `yaml:"StandbyValidators"` - SystemFee SystemFee `yaml:"SystemFee"` + SaveStorageBatch bool `yaml:"SaveStorageBatch"` + SecondsPerBlock int `yaml:"SecondsPerBlock"` + SeedList []string `yaml:"SeedList"` + StandbyValidators []string `yaml:"StandbyValidators"` // Whether to verify received blocks. VerifyBlocks bool `yaml:"VerifyBlocks"` // Whether to verify transactions in received blocks. VerifyTransactions bool `yaml:"VerifyTransactions"` } - // SystemFee fees related to system. - SystemFee struct { - RegisterTransaction int64 `yaml:"RegisterTransaction"` - } - // NetMode describes the mode the blockchain will operate on. NetMode uint32 ) @@ -69,13 +62,3 @@ func (n NetMode) String() string { return "net unknown" } } - -// TryGetValue returns the system fee base on transaction type. -func (s SystemFee) TryGetValue(txType transaction.TXType) util.Fixed8 { - switch txType { - case transaction.RegisterType: - return util.Fixed8FromInt64(s.RegisterTransaction) - default: - return util.Fixed8FromInt64(0) - } -} diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 2ba09c0dc..a7ff7d317 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -33,13 +33,6 @@ const ( headerBatchCount = 2000 version = "0.1.0" - // This one comes from C# code and it's different from the constant used - // when creating an asset with Neo.Asset.Create interop call. It looks - // like 2000000 is coming from the decrementInterval, but C# code doesn't - // contain any relationship between the two, so we should follow this - // behavior. - registeredAssetLifetime = 2 * 2000000 - defaultMemPoolSize = 50000 ) @@ -629,20 +622,6 @@ func (bc *Blockchain) storeBlock(block *block.Block) error { // Process the underlying type of the TX. switch t := tx.Data.(type) { - case *transaction.RegisterTX: - err := cache.PutAssetState(&state.Asset{ - ID: tx.Hash(), - AssetType: t.AssetType, - Name: t.Name, - Amount: t.Amount, - Precision: t.Precision, - Owner: t.Owner, - Admin: t.Admin, - Expiration: bc.BlockHeight() + registeredAssetLifetime, - }) - if err != nil { - return err - } case *transaction.InvocationTX: systemInterop := bc.newInteropContext(trigger.Application, cache, block, tx) v := SpawnVM(systemInterop) @@ -1420,9 +1399,6 @@ func (bc *Blockchain) verifyResults(t *transaction.Transaction, results []*trans if len(resultsDestroy) > 1 { return errors.New("tx has more than 1 destroy output") } - if len(resultsDestroy) == 1 && resultsDestroy[0].AssetID != UtilityTokenID() { - return errors.New("tx destroys non-utility token") - } if len(resultsIssue) > 0 { return errors.New("non issue/miner/claim tx issues tokens") @@ -1515,11 +1491,6 @@ func (bc *Blockchain) GetScriptHashesForVerifying(t *transaction.Transaction) ([ for _, c := range t.Cosigners { hashes[c.Account] = true } - switch t.Type { - case transaction.RegisterType: - reg := t.Data.(*transaction.RegisterTX) - hashes[reg.Owner.GetScriptHash()] = true - } // convert hashes to []util.Uint160 hashesResult := make([]util.Uint160, 0, len(hashes)) for h := range hashes { diff --git a/pkg/core/transaction/register.go b/pkg/core/transaction/register.go deleted file mode 100644 index 9bff3efbe..000000000 --- a/pkg/core/transaction/register.go +++ /dev/null @@ -1,82 +0,0 @@ -package transaction - -import ( - "encoding/json" - "math/rand" - - "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/nspcc-dev/neo-go/pkg/io" - "github.com/nspcc-dev/neo-go/pkg/util" -) - -// RegisterTX represents a register transaction. -// NOTE: This is deprecated. -type RegisterTX struct { - // The type of the asset being registered. - AssetType AssetType - - // Name of the asset being registered. - Name string - - // Amount registered. - // Unlimited mode -0.00000001. - Amount util.Fixed8 - - // Decimals. - Precision uint8 - - // Public key of the owner. - Owner keys.PublicKey - - Admin util.Uint160 -} - -// NewRegisterTX creates Transaction of RegisterType type. -func NewRegisterTX(register *RegisterTX) *Transaction { - return &Transaction{ - Type: RegisterType, - Version: 0, - Nonce: rand.Uint32(), - Data: register, - Attributes: []Attribute{}, - Cosigners: []Cosigner{}, - Inputs: []Input{}, - Outputs: []Output{}, - Scripts: []Witness{}, - Trimmed: false, - } -} - -// DecodeBinary implements Serializable interface. -func (tx *RegisterTX) DecodeBinary(br *io.BinReader) { - tx.AssetType = AssetType(br.ReadB()) - - tx.Name = br.ReadString() - - tx.Amount.DecodeBinary(br) - tx.Precision = uint8(br.ReadB()) - - tx.Owner.DecodeBinary(br) - - tx.Admin.DecodeBinary(br) -} - -// EncodeBinary implements Serializable interface. -func (tx *RegisterTX) EncodeBinary(bw *io.BinWriter) { - bw.WriteB(byte(tx.AssetType)) - bw.WriteString(tx.Name) - tx.Amount.EncodeBinary(bw) - bw.WriteB(byte(tx.Precision)) - bw.WriteBytes(tx.Owner.Bytes()) - tx.Admin.EncodeBinary(bw) -} - -// registeredAsset is a wrapper for RegisterTransaction -type registeredAsset struct { - AssetType AssetType `json:"type,omitempty"` - Name json.RawMessage `json:"name,omitempty"` - Amount util.Fixed8 `json:"amount,omitempty"` - Precision uint8 `json:"precision,omitempty"` - Owner keys.PublicKey `json:"owner,omitempty"` - Admin string `json:"admin,omitempty"` -} diff --git a/pkg/core/transaction/register_test.go b/pkg/core/transaction/register_test.go deleted file mode 100644 index 23d52ab0e..000000000 --- a/pkg/core/transaction/register_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package transaction - -import ( - "testing" - - "github.com/nspcc-dev/neo-go/pkg/internal/testserdes" - "github.com/nspcc-dev/neo-go/pkg/util" -) - -func TestRegisterTX(t *testing.T) { - someuint160, _ := util.Uint160DecodeStringBE("4d3b96ae1bcc5a585e075e3b81920210dec16302") - registerTx := &RegisterTX{ - AssetType: UtilityToken, - Name: "this is some token I created", - Amount: util.Fixed8FromInt64(1000000), - Precision: 8, - Admin: someuint160, - } - tx := NewRegisterTX(registerTx) - _ = tx.Hash() - - testserdes.EncodeDecodeBinary(t, tx, new(Transaction)) -} - -//TODO NEO3.0: update binary -/* -func TestDecodeRegisterTXFromRawString(t *testing.T) { - rawTX := "400000455b7b226c616e67223a227a682d434e222c226e616d65223a22e5b08fe89a81e882a1227d2c7b226c616e67223a22656e222c226e616d65223a22416e745368617265227d5d0000c16ff28623000000da1745e9b549bd0bfa1a569971c77eba30cd5a4b00000000" - b, err := hex.DecodeString(rawTX) - require.NoError(t, err) - - tx := &Transaction{} - assert.NoError(t, testserdes.DecodeBinary(b, tx)) - assert.Equal(t, RegisterType, tx.Type) - txData := tx.Data.(*RegisterTX) - assert.Equal(t, GoverningToken, txData.AssetType) - assert.Equal(t, "[{\"lang\":\"zh-CN\",\"name\":\"小蚁股\"},{\"lang\":\"en\",\"name\":\"AntShare\"}]", txData.Name) - assert.Equal(t, util.Fixed8FromInt64(100000000), txData.Amount) - assert.Equal(t, uint8(0), txData.Precision) - assert.Equal(t, keys.PublicKey{}, txData.Owner) - assert.Equal(t, "Abf2qMs1pzQb8kYk9RuxtUb9jtRKJVuBJt", address.Uint160ToString(txData.Admin)) - assert.Equal(t, "c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", tx.Hash().StringLE()) - - testserdes.EncodeDecodeBinary(t, tx, new(Transaction)) -} -*/ diff --git a/pkg/core/transaction/transaction.go b/pkg/core/transaction/transaction.go index 1fe75f6a8..b52cb1bc0 100644 --- a/pkg/core/transaction/transaction.go +++ b/pkg/core/transaction/transaction.go @@ -176,9 +176,6 @@ func (t *Transaction) decodeData(r *io.BinReader) { case InvocationType: t.Data = &InvocationTX{} t.Data.(*InvocationTX).DecodeBinary(r) - case RegisterType: - t.Data = &RegisterTX{} - t.Data.(*RegisterTX).DecodeBinary(r) default: r.Err = fmt.Errorf("invalid TX type %x", t.Type) } @@ -301,8 +298,7 @@ type transactionJSON struct { Outputs []Output `json:"vout"` Scripts []Witness `json:"scripts"` - Script string `json:"script,omitempty"` - Asset *registeredAsset `json:"asset,omitempty"` + Script string `json:"script,omitempty"` } // MarshalJSON implements json.Marshaler interface. @@ -326,16 +322,6 @@ func (t *Transaction) MarshalJSON() ([]byte, error) { switch t.Type { case InvocationType: tx.Script = hex.EncodeToString(t.Data.(*InvocationTX).Script) - case RegisterType: - transaction := *t.Data.(*RegisterTX) - tx.Asset = ®isteredAsset{ - AssetType: transaction.AssetType, - Name: json.RawMessage(transaction.Name), - Amount: transaction.Amount, - Precision: transaction.Precision, - Owner: transaction.Owner, - Admin: address.Uint160ToString(transaction.Admin), - } } return json.Marshal(tx) } @@ -371,19 +357,6 @@ func (t *Transaction) UnmarshalJSON(data []byte) error { t.Data = &InvocationTX{ Script: bytes, } - case RegisterType: - admin, err := address.StringToUint160(tx.Asset.Admin) - if err != nil { - return err - } - t.Data = &RegisterTX{ - AssetType: tx.Asset.AssetType, - Name: string(tx.Asset.Name), - Amount: tx.Asset.Amount, - Precision: tx.Asset.Precision, - Owner: tx.Asset.Owner, - Admin: admin, - } } if t.Hash() != tx.TxID { return errors.New("txid doesn't match transaction hash") diff --git a/pkg/core/transaction/transaction_test.go b/pkg/core/transaction/transaction_test.go index 5985eba59..47e37f093 100644 --- a/pkg/core/transaction/transaction_test.go +++ b/pkg/core/transaction/transaction_test.go @@ -4,7 +4,6 @@ import ( "encoding/hex" "testing" - "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/internal/testserdes" "github.com/nspcc-dev/neo-go/pkg/util" "github.com/stretchr/testify/assert" @@ -103,33 +102,3 @@ func TestMarshalUnmarshalJSONInvocationTX(t *testing.T) { testserdes.MarshalUnmarshalJSON(t, tx, new(Transaction)) } - -func TestMarshalUnmarshalJSONRegisterTX(t *testing.T) { - tx := &Transaction{ - Type: RegisterType, - Version: 5, - Data: &RegisterTX{ - AssetType: 0, - Name: `[{"lang":"zh-CN","name":"小蚁股"},{"lang":"en","name":"AntShare"}]`, - Amount: 1000000, - Precision: 0, - Owner: keys.PublicKey{}, - Admin: util.Uint160{}, - }, - Attributes: []Attribute{}, - Inputs: []Input{{ - PrevHash: util.Uint256{5, 6, 7, 8}, - PrevIndex: uint16(12), - }}, - Outputs: []Output{{ - AssetID: util.Uint256{1, 2, 3}, - Amount: util.Fixed8FromInt64(1), - ScriptHash: util.Uint160{1, 2, 3}, - Position: 0, - }}, - Scripts: []Witness{}, - Trimmed: false, - } - - testserdes.MarshalUnmarshalJSON(t, tx, new(Transaction)) -} diff --git a/pkg/core/transaction/type.go b/pkg/core/transaction/type.go index 9b13881e2..df13a6d84 100644 --- a/pkg/core/transaction/type.go +++ b/pkg/core/transaction/type.go @@ -11,15 +11,12 @@ type TXType uint8 // Constants for all valid transaction types. const ( - RegisterType TXType = 0x40 InvocationType TXType = 0xd1 ) // String implements the stringer interface. func (t TXType) String() string { switch t { - case RegisterType: - return "RegisterTransaction" case InvocationType: return "InvocationTransaction" default: @@ -46,8 +43,6 @@ func (t *TXType) UnmarshalJSON(data []byte) error { // TXTypeFromString searches for TXType by string name. func TXTypeFromString(jsonString string) (TXType, error) { switch jsonString = strings.TrimSpace(jsonString); jsonString { - case "RegisterTransaction": - return RegisterType, nil case "InvocationTransaction": return InvocationType, nil default: diff --git a/pkg/core/util.go b/pkg/core/util.go index dc518197e..5a963c80c 100644 --- a/pkg/core/util.go +++ b/pkg/core/util.go @@ -89,45 +89,6 @@ func deployNativeContracts() *transaction.Transaction { return tx } -func init() { - admin := hash.Hash160([]byte{byte(opcode.OLDPUSH1)}) - registerTX := &transaction.RegisterTX{ - AssetType: transaction.GoverningToken, - Name: "[{\"lang\":\"zh-CN\",\"name\":\"小蚁股\"},{\"lang\":\"en\",\"name\":\"AntShare\"}]", - Amount: util.Fixed8FromInt64(100000000), - Precision: 0, - Admin: admin, - } - - governingTokenTX = *transaction.NewRegisterTX(registerTX) - // TODO NEO3.0: nonce should be constant to avoid variability of token hash - governingTokenTX.Nonce = 0 - governingTokenTX.Sender = hash.Hash160([]byte{byte(opcode.OLDPUSH1)}) - - admin = hash.Hash160([]byte{0x00}) - registerTX = &transaction.RegisterTX{ - AssetType: transaction.UtilityToken, - Name: "[{\"lang\":\"zh-CN\",\"name\":\"小蚁币\"},{\"lang\":\"en\",\"name\":\"AntCoin\"}]", - Amount: calculateUtilityAmount(), - Precision: 8, - Admin: admin, - } - utilityTokenTX = *transaction.NewRegisterTX(registerTX) - // TODO NEO3.0: nonce should be constant to avoid variability of token hash - utilityTokenTX.Nonce = 0 - utilityTokenTX.Sender = hash.Hash160([]byte{byte(opcode.OLDPUSH1)}) -} - -// GoverningTokenID returns the governing token (NEO) hash. -func GoverningTokenID() util.Uint256 { - return governingTokenTX.Hash() -} - -// UtilityTokenID returns the utility token (GAS) hash. -func UtilityTokenID() util.Uint256 { - return utilityTokenTX.Hash() -} - func getValidators(cfg config.ProtocolConfiguration) ([]*keys.PublicKey, error) { validators := make([]*keys.PublicKey, len(cfg.StandbyValidators)) for i, pubKeyStr := range cfg.StandbyValidators { diff --git a/pkg/core/util_test.go b/pkg/core/util_test.go index d6f9f02a5..992b70eec 100644 --- a/pkg/core/util_test.go +++ b/pkg/core/util_test.go @@ -42,19 +42,3 @@ func TestGetConsensusAddressMainNet(t *testing.T) { assert.Equal(t, consensusScript, script.String()) assert.Equal(t, consensusAddr, address.Uint160ToString(script)) } - -func TestUtilityTokenTX(t *testing.T) { - //TODO: After we added Nonce field to transaction.Transaction, UtilityTockenTx hash - // has been changed. Update it for better times. - // Old hash is "602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7" - expect := "f882fb865bab84b99623f21eedd902286af7da8d8a4609d7acefce04c851dc1c" - assert.Equal(t, expect, UtilityTokenID().StringLE()) -} - -func TestGoverningTokenTX(t *testing.T) { - //TODO: After we added Nonce field to transaction.Transaction, GoveringTockenTx hash - // has been changed. Update it for better times. - // Old hash is "c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b" - expect := "1a5e0e3eac2abced7de9ee2de0820a5c85e63756fcdfc29b82fead86a7c07c78" - assert.Equal(t, expect, GoverningTokenID().StringLE()) -} diff --git a/pkg/interop/transaction/transaction.go b/pkg/interop/transaction/transaction.go index 83500f031..545a9b89f 100644 --- a/pkg/interop/transaction/transaction.go +++ b/pkg/interop/transaction/transaction.go @@ -24,7 +24,6 @@ func GetHash(t Transaction) []byte { // GetType returns the type of the given transaction. Possible values: // MinerTransaction = 0x00 // EnrollmentTransaction = 0x20 -// RegisterTransaction = 0x40 // StateType = 0x90 // AgencyTransaction = 0xb0 // PublishTransaction = 0xd0