transaction: remove type field, set Version to 0

Two changes being done here, because they require a lot of updates to
tests. Now we're back into version 0 and we only have one type of
transaction.

It also removes GetType and GetScript interops, both are obsolete in Neo 3.
This commit is contained in:
Roman Khimov 2020-06-05 16:07:04 +03:00
parent 2ef9ec0756
commit 21efccd300
33 changed files with 216 additions and 449 deletions

View file

@ -23,7 +23,7 @@ import (
func TestNewService(t *testing.T) {
srv := newTestService(t)
tx := transaction.NewInvocationTX([]byte{byte(opcode.PUSH1)}, 0)
tx := transaction.New([]byte{byte(opcode.PUSH1)}, 0)
tx.ValidUntilBlock = 1
addSender(t, tx)
signTx(t, srv.Chain.FeePerByte(), tx)
@ -40,7 +40,7 @@ func TestService_GetVerified(t *testing.T) {
srv := newTestService(t)
var txs []*transaction.Transaction
for i := 0; i < 4; i++ {
tx := transaction.NewInvocationTX([]byte{byte(opcode.PUSH1)}, 0)
tx := transaction.New([]byte{byte(opcode.PUSH1)}, 0)
tx.Nonce = 123 + uint32(i)
tx.ValidUntilBlock = 1
txs = append(txs, tx)
@ -54,7 +54,7 @@ func TestService_GetVerified(t *testing.T) {
p := new(Payload)
p.message = &message{}
p.SetType(payload.PrepareRequestType)
tx := transaction.NewInvocationTX([]byte{byte(opcode.PUSH1)}, 0)
tx := transaction.New([]byte{byte(opcode.PUSH1)}, 0)
tx.Nonce = 999
p.SetPayload(&prepareRequest{transactionHashes: hashes})
p.SetValidatorIndex(1)
@ -121,7 +121,7 @@ func TestService_getTx(t *testing.T) {
srv := newTestService(t)
t.Run("transaction in mempool", func(t *testing.T) {
tx := transaction.NewInvocationTX([]byte{byte(opcode.PUSH1)}, 0)
tx := transaction.New([]byte{byte(opcode.PUSH1)}, 0)
tx.Nonce = 1234
tx.ValidUntilBlock = 1
addSender(t, tx)
@ -138,7 +138,7 @@ func TestService_getTx(t *testing.T) {
})
t.Run("transaction in local cache", func(t *testing.T) {
tx := transaction.NewInvocationTX([]byte{byte(opcode.PUSH1)}, 0)
tx := transaction.New([]byte{byte(opcode.PUSH1)}, 0)
tx.Nonce = 4321
tx.ValidUntilBlock = 1
h := tx.Hash()