mintlayer / mintlayer-core

Mintlayer Core: The central repository housing the essential components to operate a Mintlayer node. It encompasses the node and wallet functionalities necessary for seamless operation, alongside an additional API server designed to facilitate applications.
https://www.mintlayer.org
MIT License
42 stars 24 forks source link

Call blockprod::find_timestamps_for_staking directly from wallet cli #1748

Closed ImplOfAnImpl closed 1 month ago

ImplOfAnImpl commented 1 month ago

This addresses the problem from #1747 where the timestamp search RPC call from wallet-cli to wallet-rpc-daemon would timeout if the search takes a long time.

To solve the problem, the call to blockprod::find_timestamps_for_staking was moved from the wallet controller to wallet-cli itself. Since the call needs PoSTimestampSearchInputData, I had to add the get_timestamp_search_input_data function to wallet RPC that returns the data. And since the data contains the private vrf key, I had to use e2e encryption for it.

In the end, I'm not sure it's worth the added complexity, because the timeout problem only exists if wallet-cli connects to wallet-rpc-daemon. Given that FindTimestampsForStaking is a "niche" (and hidden) command, probably no one will ever use it in this scenario.

ImplOfAnImpl commented 1 month ago

Obviously, this isn't a priority. I'm OK with putting this in the backlog.

I've added an issue for this - #1749

ImplOfAnImpl commented 1 month ago

Closing this for now. It can be re-visited after #1749 is implemented.