forked from TrueCloudLab/neoneo-go
transaction: update binary test data
This commit is contained in:
parent
054b77dbde
commit
04bff62d65
2 changed files with 21 additions and 21 deletions
|
@ -9,15 +9,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
//TODO NEO3.0: Update binary
|
// tx from testnet 58ea0709dac398c451fd51fdf4466f5257c77927c7909834a0ef3b469cd1a2ce
|
||||||
// https://neotracker.io/tx/fe4b3af60677204c57e573a57bdc97bc5059b05ad85b1474f84431f88d910f64
|
rawInvocationTX = "00be80024f7673890000000000261c130000000000e404210001f813c2cc8e18bbe4b3b87f8ef9105b50bb93918e01005d0300743ba40b0000000c14aa07cc3f2193a973904a09a6e60b87f1f96273970c14f813c2cc8e18bbe4b3b87f8ef9105b50bb93918e13c00c087472616e736665720c14bcaf41d684c7d4ad6ee0d99da9707b9d1f0c8e6641627d5b523801420c402360bbf64b9644c25f066dbd406454b07ab9f56e8e25d92d90c96c598f6c29d97eabdcf226f3575481662cfcdd064ee410978e5fae3f09a2f83129ba9cd82641290c2103caf763f91d3691cba5b5df3eb13e668fdace0295b37e2e259fd0fb152d354f900b4195440d78"
|
||||||
rawInvocationTX = "d101590400b33f7114839c33710da24cf8e7d536b8d244f3991cf565c8146063795d3b9b3cd55aef026eae992b91063db0db53c1087472616e7366657267c5cc1cb5392019e2cc4e6d6b5ea54c8d4b6d11acf166cb072961424c54f6000000000000000001206063795d3b9b3cd55aef026eae992b91063db0db0000014140c6a131c55ca38995402dff8e92ac55d89cbed4b98dfebbcb01acbc01bd78fa2ce2061be921b8999a9ab79c2958875bccfafe7ce1bbbaf1f56580815ea3a4feed232102d41ddce2c97be4c9aa571b8a32cbc305aa29afffbcae71b0ef568db0e93929aaac"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func decodeTransaction(rawTX string, t *testing.T) *Transaction {
|
func decodeTransaction(rawTX string, t *testing.T) *Transaction {
|
||||||
b, err1 := hex.DecodeString(rawTX)
|
b, err1 := hex.DecodeString(rawTX)
|
||||||
assert.Nil(t, err1)
|
assert.Nil(t, err1)
|
||||||
tx, err := NewTransactionFromBytes(netmode.UnitTestNet, b)
|
tx, err := NewTransactionFromBytes(netmode.TestNet, b)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
return tx
|
return tx
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package transaction
|
package transaction
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/base64"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
||||||
|
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/internal/testserdes"
|
"github.com/nspcc-dev/neo-go/pkg/internal/testserdes"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
@ -34,33 +36,32 @@ func TestWitnessEncodeDecode(t *testing.T) {
|
||||||
t.Log(len(witDecode.InvocationScript))
|
t.Log(len(witDecode.InvocationScript))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO NEO3.0: update binary
|
|
||||||
/*
|
|
||||||
|
|
||||||
func TestDecodeEncodeInvocationTX(t *testing.T) {
|
func TestDecodeEncodeInvocationTX(t *testing.T) {
|
||||||
tx := decodeTransaction(rawInvocationTX, t)
|
tx := decodeTransaction(rawInvocationTX, t)
|
||||||
assert.Equal(t, tx.Type, InvocationType)
|
|
||||||
assert.IsType(t, tx.Data, &InvocationTX{})
|
|
||||||
|
|
||||||
invocTX := tx.Data.(*InvocationTX)
|
script := "AwB0O6QLAAAADBSqB8w/IZOpc5BKCabmC4fx+WJzlwwU+BPCzI4Yu+SzuH+O+RBbULuTkY4TwAwIdHJhbnNmZXIMFLyvQdaEx9StbuDZnalwe50fDI5mQWJ9W1I4"
|
||||||
script := "0400b33f7114839c33710da24cf8e7d536b8d244f3991cf565c8146063795d3b9b3cd55aef026eae992b91063db0db53c1087472616e7366657267c5cc1cb5392019e2cc4e6d6b5ea54c8d4b6d11acf166cb072961424c54f6"
|
assert.Equal(t, script, base64.StdEncoding.EncodeToString(tx.Script))
|
||||||
assert.Equal(t, script, hex.EncodeToString(invocTX.Script))
|
assert.Equal(t, uint32(1325564094), tx.Nonce)
|
||||||
assert.Equal(t, util.Fixed8(0), invocTX.Gas)
|
assert.Equal(t, int64(9007990), tx.SystemFee)
|
||||||
|
assert.Equal(t, int64(1252390), tx.NetworkFee)
|
||||||
|
assert.Equal(t, uint32(2163940), tx.ValidUntilBlock)
|
||||||
|
assert.Equal(t, "58ea0709dac398c451fd51fdf4466f5257c77927c7909834a0ef3b469cd1a2ce", tx.Hash().StringLE())
|
||||||
|
|
||||||
assert.Equal(t, 1, len(tx.Attributes))
|
assert.Equal(t, 1, len(tx.Signers))
|
||||||
assert.Equal(t, 0, len(tx.Inputs))
|
assert.Equal(t, CalledByEntry, tx.Signers[0].Scopes)
|
||||||
assert.Equal(t, 0, len(tx.Outputs))
|
assert.Equal(t, "NiXgSLtGUjTRTgp4y9ax7vyJ9UZAjsRDVt", address.Uint160ToString(tx.Signers[0].Account))
|
||||||
invoc := "40c6a131c55ca38995402dff8e92ac55d89cbed4b98dfebbcb01acbc01bd78fa2ce2061be921b8999a9ab79c2958875bccfafe7ce1bbbaf1f56580815ea3a4feed"
|
|
||||||
verif := "2102d41ddce2c97be4c9aa571b8a32cbc305aa29afffbcae71b0ef568db0e93929aaac"
|
assert.Equal(t, 0, len(tx.Attributes))
|
||||||
|
invoc := "DEAjYLv2S5ZEwl8Gbb1AZFSwern1bo4l2S2QyWxZj2wp2X6r3PIm81dUgWYs/N0GTuQQl45frj8JovgxKbqc2CZB"
|
||||||
|
verif := "DCEDyvdj+R02kcultd8+sT5mj9rOApWzfi4ln9D7FS01T5ALQZVEDXg="
|
||||||
assert.Equal(t, 1, len(tx.Scripts))
|
assert.Equal(t, 1, len(tx.Scripts))
|
||||||
assert.Equal(t, invoc, hex.EncodeToString(tx.Scripts[0].InvocationScript))
|
assert.Equal(t, invoc, base64.StdEncoding.EncodeToString(tx.Scripts[0].InvocationScript))
|
||||||
assert.Equal(t, verif, hex.EncodeToString(tx.Scripts[0].VerificationScript))
|
assert.Equal(t, verif, base64.StdEncoding.EncodeToString(tx.Scripts[0].VerificationScript))
|
||||||
|
|
||||||
data, err := testserdes.EncodeBinary(tx)
|
data, err := testserdes.EncodeBinary(tx)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, rawInvocationTX, hex.EncodeToString(data))
|
assert.Equal(t, rawInvocationTX, hex.EncodeToString(data))
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
func TestNew(t *testing.T) {
|
func TestNew(t *testing.T) {
|
||||||
script := []byte{0x51}
|
script := []byte{0x51}
|
||||||
|
|
Loading…
Reference in a new issue