From 59b4377f904f9ca6bccf7beae777e026d8313339 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 23 Jul 2021 11:33:51 +0300 Subject: [PATCH] context: support Neo.Network.P2P.Payloads.Transaction type C# now uses this one, so use it by default, but also accept old one. --- cli/paramcontext/context.go | 2 +- pkg/smartcontract/context/context.go | 2 +- pkg/smartcontract/context/context_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/paramcontext/context.go b/cli/paramcontext/context.go index c991e2e85..0f354427c 100644 --- a/cli/paramcontext/context.go +++ b/cli/paramcontext/context.go @@ -23,7 +23,7 @@ func InitAndSave(net netmode.Magic, tx *transaction.Transaction, acc *wallet.Acc priv := acc.PrivateKey() pub := priv.PublicKey() sign := priv.SignHashable(uint32(net), tx) - scCtx := context.NewParameterContext("Neo.Core.ContractTransaction", net, tx) + scCtx := context.NewParameterContext("Neo.Network.P2P.Payloads.Transaction", net, tx) h, err := address.StringToUint160(acc.Address) if err != nil { return fmt.Errorf("invalid address: %s", acc.Address) diff --git a/pkg/smartcontract/context/context.go b/pkg/smartcontract/context/context.go index e5c3cafc5..d597e13ec 100644 --- a/pkg/smartcontract/context/context.go +++ b/pkg/smartcontract/context/context.go @@ -188,7 +188,7 @@ func (c *ParameterContext) UnmarshalJSON(data []byte) error { var verif crypto.VerifiableDecodable switch pc.Type { - case "Neo.Core.ContractTransaction": + case "Neo.Core.ContractTransaction", "Neo.Network.P2P.Payloads.Transaction": tx := new(transaction.Transaction) verif = tx default: diff --git a/pkg/smartcontract/context/context_test.go b/pkg/smartcontract/context/context_test.go index fe0603671..d3c62b135 100644 --- a/pkg/smartcontract/context/context_test.go +++ b/pkg/smartcontract/context/context_test.go @@ -77,7 +77,7 @@ func TestParameterContext_AddSignatureSimpleContract(t *testing.T) { func TestParameterContext_AddSignatureMultisig(t *testing.T) { tx := getContractTx() - c := NewParameterContext("Neo.Core.ContractTransaction", netmode.UnitTestNet, tx) + c := NewParameterContext("Neo.Network.P2P.Payloads.Transaction", netmode.UnitTestNet, tx) privs, pubs := getPrivateKeys(t, 4) pubsCopy := keys.PublicKeys(pubs).Copy() script, err := smartcontract.CreateMultiSigRedeemScript(3, pubsCopy)