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:
parent
2ef9ec0756
commit
21efccd300
33 changed files with 216 additions and 449 deletions
|
@ -102,7 +102,7 @@ func TestScriptFromWitness(t *testing.T) {
|
|||
|
||||
func TestGetHeader(t *testing.T) {
|
||||
bc := newTestChain(t)
|
||||
tx := transaction.NewInvocationTX([]byte{byte(opcode.PUSH1)}, 0)
|
||||
tx := transaction.New([]byte{byte(opcode.PUSH1)}, 0)
|
||||
tx.ValidUntilBlock = bc.BlockHeight() + 1
|
||||
assert.Nil(t, addSender(tx))
|
||||
assert.Nil(t, signTx(bc, tx))
|
||||
|
@ -267,7 +267,7 @@ func TestSubscriptions(t *testing.T) {
|
|||
emit.Bytes(script.BinWriter, []byte("yay!"))
|
||||
emit.Syscall(script.BinWriter, "Neo.Runtime.Notify")
|
||||
require.NoError(t, script.Err)
|
||||
txGood1 := transaction.NewInvocationTX(script.Bytes(), 0)
|
||||
txGood1 := transaction.New(script.Bytes(), 0)
|
||||
txGood1.Sender = neoOwner
|
||||
txGood1.Nonce = 1
|
||||
txGood1.ValidUntilBlock = 100500
|
||||
|
@ -279,7 +279,7 @@ func TestSubscriptions(t *testing.T) {
|
|||
emit.Syscall(script.BinWriter, "Neo.Runtime.Notify")
|
||||
emit.Opcode(script.BinWriter, opcode.THROW)
|
||||
require.NoError(t, script.Err)
|
||||
txBad := transaction.NewInvocationTX(script.Bytes(), 0)
|
||||
txBad := transaction.New(script.Bytes(), 0)
|
||||
txBad.Sender = neoOwner
|
||||
txBad.Nonce = 2
|
||||
txBad.ValidUntilBlock = 100500
|
||||
|
@ -289,7 +289,7 @@ func TestSubscriptions(t *testing.T) {
|
|||
emit.Bytes(script.BinWriter, []byte("yay! yay! yay!"))
|
||||
emit.Syscall(script.BinWriter, "Neo.Runtime.Notify")
|
||||
require.NoError(t, script.Err)
|
||||
txGood2 := transaction.NewInvocationTX(script.Bytes(), 0)
|
||||
txGood2 := transaction.New(script.Bytes(), 0)
|
||||
txGood2.Sender = neoOwner
|
||||
txGood2.Nonce = 3
|
||||
txGood2.ValidUntilBlock = 100500
|
||||
|
@ -311,14 +311,11 @@ func TestSubscriptions(t *testing.T) {
|
|||
for _, txExpected := range invBlock.Transactions {
|
||||
tx := <-txCh
|
||||
require.Equal(t, txExpected, tx)
|
||||
if txExpected.Type == transaction.InvocationType {
|
||||
exec := <-executionCh
|
||||
require.Equal(t, tx.Hash(), exec.TxHash)
|
||||
if exec.VMState == "HALT" {
|
||||
notif := <-notificationCh
|
||||
inv := tx.Data.(*transaction.InvocationTX)
|
||||
require.Equal(t, hash.Hash160(inv.Script), notif.ScriptHash)
|
||||
}
|
||||
exec := <-executionCh
|
||||
require.Equal(t, tx.Hash(), exec.TxHash)
|
||||
if exec.VMState == "HALT" {
|
||||
notif := <-notificationCh
|
||||
require.Equal(t, hash.Hash160(tx.Script), notif.ScriptHash)
|
||||
}
|
||||
}
|
||||
assert.Empty(t, txCh)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue