'How to not expose a function in rpc and access the function through tight coupling?

I have a function in say schelling_game pallet:

pub fn create_tree(key: SumTreeName, k: u64) -> DispatchResult {}

Now I am accessing the function in template pallet using tight coupling:

schelling_game::Pallet::<T>::create_tree(key, 2);

But the problem is create_tree is exposed in rpc, anyone can call create_tree as it is public. I want only to call it under template pallet or some other pallet without exposing it to rpc. Making it private doesn't work as I can't access it in template pallet.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source