diff --git a/pkg/core/native/native_test/cryptolib_verification_test.go b/pkg/core/native/native_test/cryptolib_verification_test.go index 2daaa6db7..3ec9ca16f 100644 --- a/pkg/core/native/native_test/cryptolib_verification_test.go +++ b/pkg/core/native/native_test/cryptolib_verification_test.go @@ -635,7 +635,7 @@ func TestCryptoLib_KoblitzMultisigVerificationScript(t *testing.T) { // Add some more network fee to pay for the witness verification. This value may be calculated precisely, // but let's keep some inaccurate value for the test. - tx.NetworkFee += 900_0000 + tx.NetworkFee = 8995470 // This transaction (along with the network magic) should be signed by the user's Koblitz private key. msg := constructMsg(t, uint32(e.Chain.GetConfig().Magic), tx) diff --git a/pkg/services/rpcsrv/server_test.go b/pkg/services/rpcsrv/server_test.go index f30892a01..632b97247 100644 --- a/pkg/services/rpcsrv/server_test.go +++ b/pkg/services/rpcsrv/server_test.go @@ -3152,10 +3152,13 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) [] body := doRPCCall(`{"jsonrpc": "2.0", "id": 1, "method": "calculatenetworkfee", "params": ["bm90IGEgdHJhbnNhY3Rpb24K"]}"`, httpSrv.URL, t) _ = checkErrGetResult(t, body, true, neorpc.InvalidParamsCode, "Invalid params") }) - calcReq := func(t *testing.T, tx *transaction.Transaction) []byte { - rpc := fmt.Sprintf(`{"jsonrpc": "2.0", "id": 1, "method": "calculatenetworkfee", "params": ["%s"]}"`, base64.StdEncoding.EncodeToString(tx.Bytes())) + calcReqExactly := func(t *testing.T, tx string) []byte { + rpc := fmt.Sprintf(`{"jsonrpc": "2.0", "id": 1, "method": "calculatenetworkfee", "params": ["%s"]}"`, tx) return doRPCCall(rpc, httpSrv.URL, t) } + calcReq := func(t *testing.T, tx *transaction.Transaction) []byte { + return calcReqExactly(t, base64.StdEncoding.EncodeToString(tx.Bytes())) + } t.Run("non-contract with zero verification", func(t *testing.T) { tx := &transaction.Transaction{ Script: []byte{byte(opcode.RET)}, @@ -3235,6 +3238,13 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) [] } checkCalc(t, tx, 2315100) // Perfectly matches FeeIsMultiSigContract() C# test. }) + t.Run("Koblitz custom multisignature witness", func(t *testing.T) { + tx := "AAIAAACWP5gAAAAAAIBniwAAAAAAAgAAAAFSPSnnAijsThGazYipphHw5ljbTgEAVgsVDBQBAgMAAAAAAAAAAAAAAAAAAAAAAAwUUj0p5wIo7E4Rms2IqaYR8OZY204UwB8MCHRyYW5zZmVyDBTPduKL0AYsSkeO41VhARMZ88+k0kFifVtSAcwMQgxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxCDEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADEIMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD9BgFXBQBDEygFSQlAE8BwDCEDL5dNUWO0ZANmSz16KYRBbhmdzE7u8DguVYmWcRLdiF4MIQNFg/P7jBdGcTXcxgjfua/nv6taGb4rLqQXYGQ3LtfuLQwhA0hxJZ8CzRWOQpvE/60SPZ7bVYGr6Kl1MiZBLnvtDpsdDCECkTKVLY6bY2bFkIbD+dViOp7w2eZ2ZWr+1kH4qFNKkP8UwHFBxfug4AMAAAAAAQAAAJ4UjUEtUQgwEM6LchBzEHRrE7hsFLiSJEIAGGhrzmlszmoUwB8MD3ZlcmlmeVdpdGhFQ0RzYQwUG/V1qxGJaIQTYQo1oSiGzeC2bHJBYn1bUmuec2ycdCK5axOz" + resp := checkErrGetResult(t, calcReqExactly(t, tx), false, 0) + res := new(result.NetworkFee) + require.NoError(t, json.Unmarshal(resp, res)) + require.Equal(t, int64(8995470), res.Value) + }) checkContract := func(t *testing.T, verAcc util.Uint160, invoc []byte, fee int64) { txScript, err := smartcontract.CreateCallWithAssertScript(chain.UtilityTokenHash(), "transfer", verAcc, verAcc, 1, nil)