fix: issues in simulate RPC (#5265)

Make `simulate` RPC easier to use:
* Prevent the use of `seed`, `secret`, `seed_hex`, and `passphrase` fields (to avoid confusing with the signing methods).
* Add autofilling of the `NetworkID` field.
This commit is contained in:
Mayukha Vadari
2025-02-07 12:17:37 -08:00
committed by GitHub
parent 02387fd227
commit d9e4009e33
7 changed files with 203 additions and 18 deletions

View File

@@ -493,9 +493,12 @@ Env::autofill(JTx& jt)
if (jt.fill_seq)
jtx::fill_seq(jv, *current());
uint32_t networkID = app().config().NETWORK_ID;
if (!jv.isMember(jss::NetworkID) && networkID > 1024)
jv[jss::NetworkID] = std::to_string(networkID);
if (jt.fill_netid)
{
uint32_t networkID = app().config().NETWORK_ID;
if (!jv.isMember(jss::NetworkID) && networkID > 1024)
jv[jss::NetworkID] = std::to_string(networkID);
}
// Must come last
try