Skip to content

Commit 748c1f7

Browse files
committed
[Ed25519] Standardize code and error messages
1 parent 965ba7a commit 748c1f7

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/bdap/rpcdomainentry.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
#include "bdap/domainentry.h"
66
#include "bdap/domainentrydb.h"
77
#include "bdap/utils.h"
8-
#include "dht/ed25519.h"
98
#include "core_io.h" // needed for ScriptToAsmStr
9+
#include "dht/ed25519.h"
1010
#include "dynodeman.h"
11+
#include "dynode-sync.h"
12+
#include "primitives/transaction.h"
1113
#include "rpcprotocol.h"
1214
#include "rpcserver.h"
13-
#include "primitives/transaction.h"
1415
#include "spork.h"
15-
#include "wallet/wallet.h"
1616
#include "validation.h"
17-
#include "dynode-sync.h"
17+
#include "wallet/wallet.h"
1818

1919
#include <univalue.h>
2020

@@ -188,7 +188,7 @@ UniValue adduser(const JSONRPCRequest& request)
188188
HelpExampleRpc("adduser", "Alice \"Wonderland, Alice\""));
189189

190190
if (!dynodeSync.IsBlockchainSynced()) {
191-
throw std::runtime_error("Error: Cannot create BDAP Objects while wallet is not synced.");
191+
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, strprintf("Cannot create BDAP Objects while wallet is not synced."));
192192
}
193193

194194
if (!sporkManager.IsSporkActive(SPORK_30_ACTIVATE_BDAP))
@@ -517,7 +517,7 @@ UniValue updateuser(const JSONRPCRequest& request)
517517
HelpExampleRpc("updateuser", "Alice \"Updated, Alice\" 365"));
518518

519519
if (!dynodeSync.IsBlockchainSynced()) {
520-
throw std::runtime_error("Error: Cannot create BDAP Objects while wallet is not synced.");
520+
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, strprintf("Cannot create BDAP Objects while wallet is not synced."));
521521
}
522522

523523
if (!sporkManager.IsSporkActive(SPORK_30_ACTIVATE_BDAP))
@@ -564,7 +564,7 @@ UniValue updategroup(const JSONRPCRequest& request)
564564
HelpExampleRpc("updategroup", "Duality \"Updated, Duality Blockchain Solutions Group\" 700"));
565565

566566
if (!dynodeSync.IsBlockchainSynced()) {
567-
throw std::runtime_error("Error: Cannot create BDAP Objects while wallet is not synced.");
567+
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, strprintf("Cannot create BDAP Objects while wallet is not synced."));
568568
}
569569

570570
if (!sporkManager.IsSporkActive(SPORK_30_ACTIVATE_BDAP))
@@ -679,7 +679,7 @@ UniValue deleteuser(const JSONRPCRequest& request)
679679
HelpExampleRpc("deleteuser", "Alice"));
680680

681681
if (!dynodeSync.IsBlockchainSynced()) {
682-
throw std::runtime_error("Error: Cannot create BDAP Objects while wallet is not synced.");
682+
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, strprintf("Cannot create BDAP Objects while wallet is not synced."));
683683
}
684684

685685
if (!sporkManager.IsSporkActive(SPORK_30_ACTIVATE_BDAP))
@@ -724,7 +724,7 @@ UniValue deletegroup(const JSONRPCRequest& request)
724724
HelpExampleRpc("deletegroup", "GroupName"));
725725

726726
if (!dynodeSync.IsBlockchainSynced()) {
727-
throw std::runtime_error("Error: Cannot create BDAP Objects while wallet is not synced.");
727+
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, strprintf("Cannot create BDAP Objects while wallet is not synced."));
728728
}
729729

730730
if (!sporkManager.IsSporkActive(SPORK_30_ACTIVATE_BDAP))
@@ -833,7 +833,7 @@ UniValue addgroup(const JSONRPCRequest& request)
833833
HelpExampleRpc("addgroup", "Duality \"Duality Blockchain Solutions Group\""));
834834

835835
if (!dynodeSync.IsBlockchainSynced()) {
836-
throw std::runtime_error("Error: Cannot create BDAP Objects while wallet is not synced.");
836+
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, strprintf("Cannot create BDAP Objects while wallet is not synced."));
837837
}
838838

839839
if (!sporkManager.IsSporkActive(SPORK_30_ACTIVATE_BDAP))

src/bdap/rpcrawbdap.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
#include "bdap/utils.h"
88
#include "core_io.h" // for EncodeHexTx
99
#include "dht/ed25519.h"
10-
#include "rpcprotocol.h"
11-
#include "rpcserver.h"
10+
#include "dynode-sync.h"
1211
#include "policy/policy.h"
1312
#include "primitives/transaction.h"
14-
#include "utilstrencodings.h"
15-
#include "dynode-sync.h"
13+
#include "rpcprotocol.h"
14+
#include "rpcserver.h"
1615
#include "spork.h"
16+
#include "utilstrencodings.h"
17+
#include "validation.h"
1718
#ifdef ENABLE_WALLET
1819
#include "wallet/wallet.h"
1920
#endif
20-
#include "validation.h"
2121

2222
#include <stdint.h>
2323

@@ -45,7 +45,7 @@ UniValue createrawbdapaccount(const JSONRPCRequest& request)
4545
EnsureWalletIsUnlocked();
4646

4747
if (!dynodeSync.IsBlockchainSynced()) {
48-
throw std::runtime_error("Error: Cannot create BDAP Objects while wallet is not synced.");
48+
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, strprintf("Cannot create BDAP Objects while wallet is not synced."));
4949
}
5050

5151
if (!sporkManager.IsSporkActive(SPORK_30_ACTIVATE_BDAP))
@@ -199,7 +199,7 @@ UniValue sendandpayrawbdapaccount(const JSONRPCRequest& request)
199199
HelpExampleRpc("sendandpayrawbdapaccount", "<hexstring>"));
200200

201201
if (!dynodeSync.IsBlockchainSynced()) {
202-
throw std::runtime_error("Error: Cannot create BDAP Objects while wallet is not synced.");
202+
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, strprintf("Cannot create BDAP Objects while wallet is not synced."));
203203
}
204204

205205
if (!sporkManager.IsSporkActive(SPORK_30_ACTIVATE_BDAP))

0 commit comments

Comments
 (0)