core: rename Neo.Crypto.Verify to Neo.Crypto.VerifyWithECDsaSecp256r1

Part of #918
This commit is contained in:
Anna Shaleva 2020-07-10 09:56:15 +03:00
parent 8f17c7fb05
commit 17233e1d8e
26 changed files with 77 additions and 77 deletions

View file

@ -2,11 +2,11 @@
"version": "3.0", "version": "3.0",
"accounts": [ "accounts": [
{ {
"address": "NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN", "address": "NbTiM6h8r99kpRtb428XcsUk1TzKed2gTc",
"key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
"label": "", "label": "",
"contract": { "contract": {
"script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ=", "script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQZVEDXg=",
"parameters": [ "parameters": [
{ {
"name": "parameter0", "name": "parameter0",
@ -20,7 +20,7 @@
}, },
{ {
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
"key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
"label": "", "label": "",
"contract": { "contract": {
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",

View file

@ -2,11 +2,11 @@
"version": "3.0", "version": "3.0",
"accounts": [ "accounts": [
{ {
"address": "NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN", "address": "NbTiM6h8r99kpRtb428XcsUk1TzKed2gTc",
"key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
"label": "", "label": "",
"contract": { "contract": {
"script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ=", "script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQZVEDXg=",
"parameters": [ "parameters": [
{ {
"name": "parameter0", "name": "parameter0",
@ -20,7 +20,7 @@
}, },
{ {
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
"key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
"label": "", "label": "",
"contract": { "contract": {
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
@ -45,7 +45,7 @@
}, },
{ {
"address": "NYqxsNMHxDg3T19APYP27mBZFfauC4zngR", "address": "NYqxsNMHxDg3T19APYP27mBZFfauC4zngR",
"key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
"label": "", "label": "",
"contract": { "contract": {
"script": "EQwhArNiK/QBe9/jF8WK7V9MdT8ga324lgRvp9d0u8S/f43CEQtBMHOzuw==", "script": "EQwhArNiK/QBe9/jF8WK7V9MdT8ga324lgRvp9d0u8S/f43CEQtBMHOzuw==",

View file

@ -2,11 +2,11 @@
"version": "3.0", "version": "3.0",
"accounts": [ "accounts": [
{ {
"address": "NNsXzAGGVY3H3viPHzaoD6BcVtqNCdMAHZ", "address": "NWvKSwutC8D6VKmmPxAEgFKx2NLvFhn8q5",
"key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "key": "6PYKEHagXJ3mDLdga1FoyTGRtPdJgPz6Gb8sjEFwZvRu7ncD9PVZfHtMzL",
"label": "", "label": "",
"contract": { "contract": {
"script": "DCECEDp/fdAWVYWX95YNJ8UWpDlP2Wi55lFV60sBPkBAQG4LQQqQatQ=", "script": "DCECEDp/fdAWVYWX95YNJ8UWpDlP2Wi55lFV60sBPkBAQG4LQZVEDXg=",
"parameters": [ "parameters": [
{ {
"name": "parameter0", "name": "parameter0",
@ -20,7 +20,7 @@
}, },
{ {
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
"key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "key": "6PYKEHagXJ3mDLdga1FoyTGRtPdJgPz6Gb8sjEFwZvRu7ncD9PVZfHtMzL",
"label": "", "label": "",
"contract": { "contract": {
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",

View file

@ -2,11 +2,11 @@
"version": "3.0", "version": "3.0",
"accounts": [ "accounts": [
{ {
"address": "Nfzhk6dtjLZE93iGkqYv5pwrTW5QRQk5bV", "address": "NNB3RsnTABEwoKEudNG92njds91WtiCuxd",
"key": "6PYU172i51nsGS1P72gYq4czWdbUvMBQvrJnrJ1VEMZhmXPN6iX4jkmixC", "key": "6PYLjn1Zw3RQmP3CkDxoZvYtMpu7ZUdjHnvu7wPuohUcXWCMh9vY661R8A",
"label": "", "label": "",
"contract": { "contract": {
"script": "DCED2QwH32PmkM53kS4Qq1GsyUS2aGAje2CMT4+DCece5pkLQQqQatQ=", "script": "DCED2QwH32PmkM53kS4Qq1GsyUS2aGAje2CMT4+DCece5pkLQZVEDXg=",
"parameters": [ "parameters": [
{ {
"name": "parameter0", "name": "parameter0",
@ -20,7 +20,7 @@
}, },
{ {
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
"key": "6PYU172i51nsGS1P72gYq4czWdbUvMBQvrJnrJ1VEMZhmXPN6iX4jkmixC", "key": "6PYLjn1Zw3RQmP3CkDxoZvYtMpu7ZUdjHnvu7wPuohUcXWCMh9vY661R8A",
"label": "", "label": "",
"contract": { "contract": {
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",

View file

@ -2,11 +2,11 @@
"version": "3.0", "version": "3.0",
"accounts": [ "accounts": [
{ {
"address": "NU5BGveyZSQ7TUAxRnKVDXgE9oExpzV5vY", "address": "Nfzo95iBXfeAGx5rdjPedZRAqHKh9hwMdR",
"key": "6PYW1FxFURLUrFCzLRwoChXHGn77Fy8qDB5j1sUjpbi6mk4J1KgTR8vvAk", "key": "6PYLbYYg9jUgzJQpKhpvNExa2UEgtp4356XPg56pHuCpE7gQmj84ESNjYW",
"label": "", "label": "",
"contract": { "contract": {
"script": "DCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWILQQqQatQ=", "script": "DCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWILQZVEDXg=",
"parameters": [ "parameters": [
{ {
"name": "parameter0", "name": "parameter0",
@ -20,7 +20,7 @@
}, },
{ {
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
"key": "6PYW1FxFURLUrFCzLRwoChXHGn77Fy8qDB5j1sUjpbi6mk4J1KgTR8vvAk", "key": "6PYLbYYg9jUgzJQpKhpvNExa2UEgtp4356XPg56pHuCpE7gQmj84ESNjYW",
"label": "", "label": "",
"contract": { "contract": {
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",

View file

@ -6,7 +6,7 @@ var syscalls = map[string]map[string]string{
"Deserialize": "System.Binary.Deserialize", "Deserialize": "System.Binary.Deserialize",
}, },
"crypto": { "crypto": {
"ECDsaVerify": "Neo.Crypto.ECDsaVerify", "ECDsaSecp256r1Verify": "Neo.Crypto.VerifyWithECDsaSecp256r1",
}, },
"enumerator": { "enumerator": {
"Concat": "System.Enumerator.Concat", "Concat": "System.Enumerator.Concat",

View file

@ -19,7 +19,7 @@ func TestVerifyGood(t *testing.T) {
src := getVerifyProg(pub, sig, msg) src := getVerifyProg(pub, sig, msg)
v, p := vmAndCompileInterop(t, src) v, p := vmAndCompileInterop(t, src)
p.interops[emit.InteropNameToID([]byte("Neo.Crypto.ECDsaVerify"))] = func(v *vm.VM) error { p.interops[emit.InteropNameToID([]byte("Neo.Crypto.VerifyWithECDsaSecp256r1"))] = func(v *vm.VM) error {
assert.Equal(t, msg, v.Estack().Pop().Bytes()) assert.Equal(t, msg, v.Estack().Pop().Bytes())
assert.Equal(t, pub, v.Estack().Pop().Bytes()) assert.Equal(t, pub, v.Estack().Pop().Bytes())
assert.Equal(t, sig, v.Estack().Pop().Bytes()) assert.Equal(t, sig, v.Estack().Pop().Bytes())
@ -54,7 +54,7 @@ func getVerifyProg(pub, sig, msg []byte) string {
pub := ` + pubS + ` pub := ` + pubS + `
sig := ` + sigS + ` sig := ` + sigS + `
msg := ` + msgS + ` msg := ` + msgS + `
return crypto.ECDsaVerify(msg, pub, sig) return crypto.ECDsaSecp256r1Verify(msg, pub, sig)
} }
` `
} }

View file

@ -1,7 +1,6 @@
package consensus package consensus
import ( import (
"encoding/hex"
"math/rand" "math/rand"
"testing" "testing"
@ -75,6 +74,7 @@ func TestConsensusPayload_Setters(t *testing.T) {
require.Equal(t, pl, p.GetRecoveryMessage()) require.Equal(t, pl, p.GetRecoveryMessage())
} }
/*// TODO: update binary (see https://github.com/nspcc-dev/neo-go/issues/1178)
func TestConsensusPayload_Verify(t *testing.T) { func TestConsensusPayload_Verify(t *testing.T) {
// signed payload from testnet // signed payload from testnet
dataHex := "00000000a70b769e4af60878f6daa72be41770c62592c694bf9ead6b16b30ad90f28c4098cc704000400423000d5b4baae11191ac370a4d7860df01824fcea7f934d6461db6d4b7966ca3c135c8c262b7f23bbac13e73885223604141e062234d999068d9a74b77caeeb5271cf01420c4055ae8c7694c296e92da393f944b0dc1cd70d12de3ee944e9afc872d1db427fe87fcbe913709a8ec73e2f5acdfc0b7f0a96e9d63bad0a20e3226c882237f5c771290c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0b410a906ad4" dataHex := "00000000a70b769e4af60878f6daa72be41770c62592c694bf9ead6b16b30ad90f28c4098cc704000400423000d5b4baae11191ac370a4d7860df01824fcea7f934d6461db6d4b7966ca3c135c8c262b7f23bbac13e73885223604141e062234d999068d9a74b77caeeb5271cf01420c4055ae8c7694c296e92da393f944b0dc1cd70d12de3ee944e9afc872d1db427fe87fcbe913709a8ec73e2f5acdfc0b7f0a96e9d63bad0a20e3226c882237f5c771290c2102a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b0b410a906ad4"
@ -89,7 +89,7 @@ func TestConsensusPayload_Verify(t *testing.T) {
require.NoError(t, p.decodeData()) require.NoError(t, p.decodeData())
require.True(t, p.Verify(h)) require.True(t, p.Verify(h))
} }
*/
func TestConsensusPayload_Serializable(t *testing.T) { func TestConsensusPayload_Serializable(t *testing.T) {
for _, mt := range messageTypes { for _, mt := range messageTypes {
p := randomPayload(t, mt) p := randomPayload(t, mt)

View file

@ -2,11 +2,11 @@
"version": "3.0", "version": "3.0",
"accounts": [ "accounts": [
{ {
"address": "NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN", "address": "NbTiM6h8r99kpRtb428XcsUk1TzKed2gTc",
"key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
"label": "", "label": "",
"contract": { "contract": {
"script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ=", "script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQZVEDXg=",
"parameters": [ "parameters": [
{ {
"name": "parameter0", "name": "parameter0",
@ -20,7 +20,7 @@
}, },
{ {
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
"key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
"label": "", "label": "",
"contract": { "contract": {
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",

View file

@ -2,11 +2,11 @@
"version": "3.0", "version": "3.0",
"accounts": [ "accounts": [
{ {
"address": "NNsXzAGGVY3H3viPHzaoD6BcVtqNCdMAHZ", "address": "NWvKSwutC8D6VKmmPxAEgFKx2NLvFhn8q5",
"key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "key": "6PYKEHagXJ3mDLdga1FoyTGRtPdJgPz6Gb8sjEFwZvRu7ncD9PVZfHtMzL",
"label": "", "label": "",
"contract": { "contract": {
"script": "DCECEDp/fdAWVYWX95YNJ8UWpDlP2Wi55lFV60sBPkBAQG4LQQqQatQ=", "script": "DCECEDp/fdAWVYWX95YNJ8UWpDlP2Wi55lFV60sBPkBAQG4LQZVEDXg=",
"parameters": [ "parameters": [
{ {
"name": "parameter0", "name": "parameter0",
@ -20,7 +20,7 @@
}, },
{ {
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
"key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "key": "6PYKEHagXJ3mDLdga1FoyTGRtPdJgPz6Gb8sjEFwZvRu7ncD9PVZfHtMzL",
"label": "", "label": "",
"contract": { "contract": {
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",

View file

@ -2,11 +2,11 @@
"version": "3.0", "version": "3.0",
"accounts": [ "accounts": [
{ {
"address": "Nfzhk6dtjLZE93iGkqYv5pwrTW5QRQk5bV", "address": "NNB3RsnTABEwoKEudNG92njds91WtiCuxd",
"key": "6PYU172i51nsGS1P72gYq4czWdbUvMBQvrJnrJ1VEMZhmXPN6iX4jkmixC", "key": "6PYLjn1Zw3RQmP3CkDxoZvYtMpu7ZUdjHnvu7wPuohUcXWCMh9vY661R8A",
"label": "", "label": "",
"contract": { "contract": {
"script": "DCED2QwH32PmkM53kS4Qq1GsyUS2aGAje2CMT4+DCece5pkLQQqQatQ=", "script": "DCED2QwH32PmkM53kS4Qq1GsyUS2aGAje2CMT4+DCece5pkLQZVEDXg=",
"parameters": [ "parameters": [
{ {
"name": "parameter0", "name": "parameter0",
@ -20,7 +20,7 @@
}, },
{ {
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
"key": "6PYU172i51nsGS1P72gYq4czWdbUvMBQvrJnrJ1VEMZhmXPN6iX4jkmixC", "key": "6PYLjn1Zw3RQmP3CkDxoZvYtMpu7ZUdjHnvu7wPuohUcXWCMh9vY661R8A",
"label": "", "label": "",
"contract": { "contract": {
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",

View file

@ -2,11 +2,11 @@
"version": "3.0", "version": "3.0",
"accounts": [ "accounts": [
{ {
"address": "NU5BGveyZSQ7TUAxRnKVDXgE9oExpzV5vY", "address": "Nfzo95iBXfeAGx5rdjPedZRAqHKh9hwMdR",
"key": "6PYW1FxFURLUrFCzLRwoChXHGn77Fy8qDB5j1sUjpbi6mk4J1KgTR8vvAk", "key": "6PYLbYYg9jUgzJQpKhpvNExa2UEgtp4356XPg56pHuCpE7gQmj84ESNjYW",
"label": "", "label": "",
"contract": { "contract": {
"script": "DCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWILQQqQatQ=", "script": "DCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWILQZVEDXg=",
"parameters": [ "parameters": [
{ {
"name": "parameter0", "name": "parameter0",
@ -20,7 +20,7 @@
}, },
{ {
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
"key": "6PYW1FxFURLUrFCzLRwoChXHGn77Fy8qDB5j1sUjpbi6mk4J1KgTR8vvAk", "key": "6PYLbYYg9jUgzJQpKhpvNExa2UEgtp4356XPg56pHuCpE7gQmj84ESNjYW",
"label": "", "label": "",
"contract": { "contract": {
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",

View file

@ -15,8 +15,8 @@ import (
// ECDSAVerifyPrice is a gas price of a single verification. // ECDSAVerifyPrice is a gas price of a single verification.
const ECDSAVerifyPrice = 1000000 const ECDSAVerifyPrice = 1000000
// ECDSAVerify checks ECDSA signature. // ECDSASecp256r1Verify checks ECDSA signature using Secp256r1 elliptic curve.
func ECDSAVerify(ic *interop.Context, v *vm.VM) error { func ECDSASecp256r1Verify(ic *interop.Context, v *vm.VM) error {
msg := getMessage(ic, v.Estack().Pop().Item()) msg := getMessage(ic, v.Estack().Pop().Item())
hashToCheck := hash.Sha256(msg).BytesBE() hashToCheck := hash.Sha256(msg).BytesBE()
keyb := v.Estack().Pop().Bytes() keyb := v.Estack().Pop().Bytes()

View file

@ -7,7 +7,7 @@ import (
) )
var ( var (
ecdsaVerifyID = emit.InteropNameToID([]byte("Neo.Crypto.ECDsaVerify")) ecdsaSecp256r1VerifyID = emit.InteropNameToID([]byte("Neo.Crypto.VerifyWithECDsaSecp256r1"))
ecdsaCheckMultisigID = emit.InteropNameToID([]byte("Neo.Crypto.ECDsaCheckMultiSig")) ecdsaCheckMultisigID = emit.InteropNameToID([]byte("Neo.Crypto.ECDsaCheckMultiSig"))
sha256ID = emit.InteropNameToID([]byte("Neo.Crypto.SHA256")) sha256ID = emit.InteropNameToID([]byte("Neo.Crypto.SHA256"))
) )
@ -16,10 +16,10 @@ var (
func GetInterop(ic *interop.Context) func(uint32) *vm.InteropFuncPrice { func GetInterop(ic *interop.Context) func(uint32) *vm.InteropFuncPrice {
return func(id uint32) *vm.InteropFuncPrice { return func(id uint32) *vm.InteropFuncPrice {
switch id { switch id {
case ecdsaVerifyID: case ecdsaSecp256r1VerifyID:
return &vm.InteropFuncPrice{ return &vm.InteropFuncPrice{
Func: func(v *vm.VM) error { Func: func(v *vm.VM) error {
return ECDSAVerify(ic, v) return ECDSASecp256r1Verify(ic, v)
}, },
} }
case ecdsaCheckMultisigID: case ecdsaCheckMultisigID:

View file

@ -159,7 +159,7 @@ func TestECDSAVerify(t *testing.T) {
err = fmt.Errorf("panic: %v", r) err = fmt.Errorf("panic: %v", r)
} }
}() }()
err = crypto.ECDSAVerify(ic, v) err = crypto.ECDSASecp256r1Verify(ic, v)
}() }()
if isErr { if isErr {

View file

@ -138,7 +138,7 @@ var systemInterops = []interop.Function{
} }
var neoInterops = []interop.Function{ var neoInterops = []interop.Function{
{Name: "Neo.Crypto.ECDsaVerify", Func: crypto.ECDSAVerify, Price: crypto.ECDSAVerifyPrice}, {Name: "Neo.Crypto.VerifyWithECDsaSecp256r1", Func: crypto.ECDSASecp256r1Verify, Price: crypto.ECDSAVerifyPrice},
{Name: "Neo.Crypto.ECDsaCheckMultiSig", Func: crypto.ECDSACheckMultisig, Price: 0}, {Name: "Neo.Crypto.ECDsaCheckMultiSig", Func: crypto.ECDSACheckMultisig, Price: 0},
{Name: "Neo.Crypto.SHA256", Func: crypto.Sha256, Price: 1000000}, {Name: "Neo.Crypto.SHA256", Func: crypto.Sha256, Price: 1000000},
{Name: "Neo.Native.Deploy", Func: native.Deploy, Price: 0, {Name: "Neo.Native.Deploy", Func: native.Deploy, Price: 0,

View file

@ -283,7 +283,7 @@ func (p *PublicKey) GetVerificationScript() []byte {
} }
emit.Bytes(buf.BinWriter, b) emit.Bytes(buf.BinWriter, b)
emit.Opcode(buf.BinWriter, opcode.PUSHNULL) emit.Opcode(buf.BinWriter, opcode.PUSHNULL)
emit.Syscall(buf.BinWriter, "Neo.Crypto.ECDsaVerify") emit.Syscall(buf.BinWriter, "Neo.Crypto.VerifyWithECDsaSecp256r1")
return buf.Bytes() return buf.Bytes()
} }

View file

@ -106,7 +106,7 @@ func TestPubkeyToAddress(t *testing.T) {
pubKey, err := NewPublicKeyFromString("031ee4e73a17d8f76dc02532e2620bcb12425b33c0c9f9694cc2caa8226b68cad4") pubKey, err := NewPublicKeyFromString("031ee4e73a17d8f76dc02532e2620bcb12425b33c0c9f9694cc2caa8226b68cad4")
require.NoError(t, err) require.NoError(t, err)
actual := pubKey.Address() actual := pubKey.Address()
expected := "NNqoUeNb2tfhEExY7mrPbxf4EZZRKX5nHF" expected := "NcKJdJTEDeCSV9BJAKWWxkBMcHTeVnSzJo"
require.Equal(t, expected, actual) require.Equal(t, expected, actual)
} }

View file

@ -14,28 +14,28 @@ type Ktype struct {
// Arr contains a set of known keys in Ktype format. // Arr contains a set of known keys in Ktype format.
var Arr = []Ktype{ var Arr = []Ktype{
{ {
Address: "NMPAXGtMfZ8s8rcfP9JhrYrNeZHG4xSVmd", Address: "NNWAo5vdVJz1oyCuNiaTBA3amBHnWCF4Yk",
PrivateKey: "7d128a6d096f0c14c3a25a2b0c41cf79661bfcb4a8cc95aaaea28bde4d732344", PrivateKey: "7d128a6d096f0c14c3a25a2b0c41cf79661bfcb4a8cc95aaaea28bde4d732344",
PublicKey: "02028a99826edc0c97d18e22b6932373d908d323aa7f92656a77ec26e8861699ef", PublicKey: "02028a99826edc0c97d18e22b6932373d908d323aa7f92656a77ec26e8861699ef",
Wif: "L1QqQJnpBwbsPGAuutuzPTac8piqvbR1HRjrY5qHup48TBCBFe4g", Wif: "L1QqQJnpBwbsPGAuutuzPTac8piqvbR1HRjrY5qHup48TBCBFe4g",
Passphrase: "city of zion", Passphrase: "city of zion",
EncryptedWif: "6PYWdzMKGbfxHbfb2JqZJ5Yr1y6jjjuSPLjvgS4byvDkgz2NdiBgeJwBFc", EncryptedWif: "6PYSeMMbJtfMRD81eHzriwrRKquu2dgLNurYcAbmJa7YqAiThgA2vGQu5o",
}, },
{ {
Address: "NRC6oteucWYXq7aASD6YWe5rNeXAw1ehye", Address: "NiwvMyWYeNghLG8tDyKkWwuZV3wS8CPrrV",
PrivateKey: "9ab7e154840daca3a2efadaf0df93cd3a5b51768c632f5433f86909d9b994a69", PrivateKey: "9ab7e154840daca3a2efadaf0df93cd3a5b51768c632f5433f86909d9b994a69",
PublicKey: "031d8e1630ce640966967bc6d95223d21f44304133003140c3b52004dc981349c9", PublicKey: "031d8e1630ce640966967bc6d95223d21f44304133003140c3b52004dc981349c9",
Wif: "L2QTooFoDFyRFTxmtiVHt5CfsXfVnexdbENGDkkrrgTTryiLsPMG", Wif: "L2QTooFoDFyRFTxmtiVHt5CfsXfVnexdbENGDkkrrgTTryiLsPMG",
Passphrase: "我的密码", Passphrase: "我的密码",
EncryptedWif: "6PYLxXgqE8MaQJr3NR96rfFBxzdNLytb3CfxeDXyijSEG2M1vF9d4CoRAg", EncryptedWif: "6PYKWKaq5NMyjt8cjvnJnvmV13inhFuePpWZMkddFAMCgjC3ETt7kX16V9",
}, },
{ {
Address: "NTFAwXLGoiWwSMP5vJyZp8K4cBFwrzUs8m", Address: "NTWHAzB82LRGWNuuqjVyyzpGvF3WxbbPoG",
PrivateKey: "3edee7036b8fd9cef91de47386b191dd76db2888a553e7736bb02808932a915b", PrivateKey: "3edee7036b8fd9cef91de47386b191dd76db2888a553e7736bb02808932a915b",
PublicKey: "02232ce8d2e2063dce0451131851d47421bfc4fc1da4db116fca5302c0756462fa", PublicKey: "02232ce8d2e2063dce0451131851d47421bfc4fc1da4db116fca5302c0756462fa",
Wif: "KyKvWLZsNwBJx5j9nurHYRwhYfdQUu9tTEDsLCUHDbYBL8cHxMiG", Wif: "KyKvWLZsNwBJx5j9nurHYRwhYfdQUu9tTEDsLCUHDbYBL8cHxMiG",
Passphrase: "MyL33tP@33w0rd", Passphrase: "MyL33tP@33w0rd",
EncryptedWif: "6PYRoabFnWARA3ZWwfJ4efQ4uuuB9WdVrA1LFbMkZLtXZ2DJg3bzjiK59s", EncryptedWif: "6PYSzKoJBQMj9uHUv1Sc2ZhMrydqDF8ZCTeE9FuPiNdEx7Lo9NoEuaXeyk",
}, },
{ {
Address: "xdf4UGKevVrMR1j3UkPsuoYKSC4ocoAkKx", Address: "xdf4UGKevVrMR1j3UkPsuoYKSC4ocoAkKx",
@ -43,7 +43,7 @@ var Arr = []Ktype{
PublicKey: "zz232ce8d2e2063dce0451131851d47421bfc4fc1da4db116fca5302c0756462fa", PublicKey: "zz232ce8d2e2063dce0451131851d47421bfc4fc1da4db116fca5302c0756462fa",
Wif: "zzKvWLZsNwBJx5j9nurHYRwhYfdQUu9tTEDsLCUHDbYBL8cHxMiG", Wif: "zzKvWLZsNwBJx5j9nurHYRwhYfdQUu9tTEDsLCUHDbYBL8cHxMiG",
Passphrase: "zzL33tP@33w0rd", Passphrase: "zzL33tP@33w0rd",
EncryptedWif: "6PYRoabFnWARA3ZWwfJ4efQ4uuuB9WdVrA1LFbMkZLtXZ2DJg3bzjiK59s", EncryptedWif: "6PYSzKoJBQMj9uHUv1Sc2ZhMrydqDF8ZCTeE9FuPiNdEx7Lo9NoEuaXeyk",
Invalid: true, Invalid: true,
}, },
} }

View file

@ -8,8 +8,8 @@ func SHA256(b []byte) []byte {
return nil return nil
} }
// ECDsaVerify checks that sig is correct msg's signature for a given pub // ECDsaSecp256r1Verify checks that sig is correct msg's signature for a given pub
// (serialized public key). It uses `Neo.Crypto.ECDsaVerify` syscall. // (serialized public key). It uses `Neo.Crypto.VerifyWithECDsaSecp256r1` syscall.
func ECDsaVerify(msg []byte, pub []byte, sig []byte) bool { func ECDsaSecp256r1Verify(msg []byte, pub []byte, sig []byte) bool {
return false return false
} }

View file

@ -52,7 +52,7 @@ type rpcTestCase struct {
} }
const testContractHash = "10e262ef80c76bdecca287a2c047841fc02c3129" const testContractHash = "10e262ef80c76bdecca287a2c047841fc02c3129"
const deploymentTxHash = "4843700d16be3e6507a25909d3b2aa1472dcd0526be2520f2bfdd53d768bfebf" const deploymentTxHash = "49f555734b90eb7d4f87041b5146a9b6bc7cf70060bb665212773719091b3a81"
var rpcTestCases = map[string][]rpcTestCase{ var rpcTestCases = map[string][]rpcTestCase{
"getapplicationlog": { "getapplicationlog": {
@ -720,7 +720,7 @@ var rpcTestCases = map[string][]rpcTestCase{
"sendrawtransaction": { "sendrawtransaction": {
{ {
name: "positive", name: "positive",
params: `["000a000000316e851039019d39dfc2c37d6c3fee19fd58098780969800000000009269130000000000b00400000001316e851039019d39dfc2c37d6c3fee19fd580987015d0300e87648170000000c1420728274afafc36f43a071d328cfa3e629d9cbb00c14316e851039019d39dfc2c37d6c3fee19fd58098713c00c087472616e736665720c14897720d8cd76f4f00abfa37c0edd889c208fde9b41627d5b523801420c4037c8c002c3352329c5f2995567a355d57372447c156ea544844d5f8027babf4cd86142d986681992805e3f62f2625b551f18cf05897e6ea7c135f22537bb740e290c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4"]`, params: `["000a000000aa8acf859d4fe402b34e673f2156821796a488eb80969800000000009269130000000000b00400000001aa8acf859d4fe402b34e673f2156821796a488eb015d0300e87648170000000c1478ba4c24009fe510e136c9995a2e05215e1be4dc0c14aa8acf859d4fe402b34e673f2156821796a488eb13c00c087472616e736665720c14897720d8cd76f4f00abfa37c0edd889c208fde9b41627d5b523801420c4040719393aa590d962cb5a48e16360ac75a6c358c9699e9f1a853afede4d601b6783e28f5ec74542aaf59519e76830ba9d267656db324461fdb08d1d51521e103290c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b4195440d78"]`,
result: func(e *executor) interface{} { result: func(e *executor) interface{} {
v := true v := true
return &v return &v

Binary file not shown.

View file

@ -10,7 +10,7 @@ import (
) )
var ( var (
verifyInteropID = emit.InteropNameToID([]byte("Neo.Crypto.ECDsaVerify")) verifyInteropID = emit.InteropNameToID([]byte("Neo.Crypto.VerifyWithECDsaSecp256r1"))
multisigInteropID = emit.InteropNameToID([]byte("Neo.Crypto.ECDsaCheckMultiSig")) multisigInteropID = emit.InteropNameToID([]byte("Neo.Crypto.ECDsaCheckMultiSig"))
) )

View file

@ -2,11 +2,11 @@
"version": "3.0", "version": "3.0",
"accounts": [ "accounts": [
{ {
"address": "NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN", "address": "NbTiM6h8r99kpRtb428XcsUk1TzKed2gTc",
"key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
"label": "", "label": "",
"contract": { "contract": {
"script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ=", "script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQZVEDXg=",
"parameters": [ "parameters": [
{ {
"name": "parameter0", "name": "parameter0",
@ -20,7 +20,7 @@
}, },
{ {
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
"key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
"label": "", "label": "",
"contract": { "contract": {
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",

View file

@ -2,11 +2,11 @@
"version": "3.0", "version": "3.0",
"accounts": [ "accounts": [
{ {
"address": "NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN", "address": "NbTiM6h8r99kpRtb428XcsUk1TzKed2gTc",
"key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
"label": "", "label": "",
"contract": { "contract": {
"script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ=", "script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQZVEDXg=",
"parameters": [ "parameters": [
{ {
"name": "parameter0", "name": "parameter0",
@ -20,7 +20,7 @@
}, },
{ {
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", "address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
"key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
"label": "", "label": "",
"contract": { "contract": {
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
@ -44,11 +44,11 @@
"isDefault": false "isDefault": false
}, },
{ {
"address": "NNsXzAGGVY3H3viPHzaoD6BcVtqNCdMAHZ", "address": "NWvKSwutC8D6VKmmPxAEgFKx2NLvFhn8q5",
"key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "key": "6PYKEHagXJ3mDLdga1FoyTGRtPdJgPz6Gb8sjEFwZvRu7ncD9PVZfHtMzL",
"label": "", "label": "",
"contract": { "contract": {
"script": "DCECEDp/fdAWVYWX95YNJ8UWpDlP2Wi55lFV60sBPkBAQG4LQQqQatQ=", "script": "DCECEDp/fdAWVYWX95YNJ8UWpDlP2Wi55lFV60sBPkBAQG4LQZVEDXg=",
"parameters": [ "parameters": [
{ {
"name": "parameter0", "name": "parameter0",

View file

@ -181,14 +181,14 @@ func TestWalletGetChangeAddress(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
sh := w1.GetChangeAddress() sh := w1.GetChangeAddress()
// No default address, the first one is used. // No default address, the first one is used.
expected, err := address.StringToUint160("NQRLhCpAru9BjGsMwk67vdMwmzKMRgsnnN") expected, err := address.StringToUint160("NbTiM6h8r99kpRtb428XcsUk1TzKed2gTc")
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, expected, sh) require.Equal(t, expected, sh)
w2, err := NewWalletFromFile("testdata/wallet2.json") w2, err := NewWalletFromFile("testdata/wallet2.json")
require.NoError(t, err) require.NoError(t, err)
sh = w2.GetChangeAddress() sh = w2.GetChangeAddress()
// Default address. // Default address.
expected, err = address.StringToUint160("NNsXzAGGVY3H3viPHzaoD6BcVtqNCdMAHZ") expected, err = address.StringToUint160("NWvKSwutC8D6VKmmPxAEgFKx2NLvFhn8q5")
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, expected, sh) require.Equal(t, expected, sh)
} }