context: support Neo.Network.P2P.Payloads.Transaction type

C# now uses this one, so use it by default, but also accept old one.
This commit is contained in:
Roman Khimov 2021-07-23 11:33:51 +03:00
parent ad35db66b5
commit 59b4377f90
3 changed files with 3 additions and 3 deletions

View file

@ -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)

View file

@ -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:

View file

@ -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)