@@ -30,36 +30,133 @@ var (
30
30
31
31
// General application defined JSON errors.
32
32
const (
33
- ErrRPCMisc RPCErrorCode = - 1
33
+ // ErrRPCMisc indicates an exception thrown during command handling.
34
+ ErrRPCMisc RPCErrorCode = - 1
35
+
36
+ // ErrRPCForbiddenBySafeMode indicates that server is in safe mode, and
37
+ // command is not allowed in safe mode.
34
38
ErrRPCForbiddenBySafeMode RPCErrorCode = - 2
35
- ErrRPCType RPCErrorCode = - 3
39
+
40
+ // ErrRPCType indicates that an unexpected type was passed as parameter.
41
+ ErrRPCType RPCErrorCode = - 3
42
+
43
+ // ErrRPCInvalidAddressOrKey indicates an invalid address or key.
36
44
ErrRPCInvalidAddressOrKey RPCErrorCode = - 5
37
- ErrRPCOutOfMemory RPCErrorCode = - 7
38
- ErrRPCInvalidParameter RPCErrorCode = - 8
39
- ErrRPCDatabase RPCErrorCode = - 20
40
- ErrRPCDeserialization RPCErrorCode = - 22
41
- ErrRPCVerify RPCErrorCode = - 25
42
- ErrRPCInWarmup RPCErrorCode = - 28
45
+
46
+ // ErrRPCOutOfMemory indicates that the server ran out of memory during
47
+ // operation.
48
+ ErrRPCOutOfMemory RPCErrorCode = - 7
49
+
50
+ // ErrRPCInvalidParameter indicates an invalid, missing, or duplicate
51
+ // parameter.
52
+ ErrRPCInvalidParameter RPCErrorCode = - 8
53
+
54
+ // ErrRPCDatabase indicates a database error.
55
+ ErrRPCDatabase RPCErrorCode = - 20
56
+
57
+ // ErrRPCDeserialization indicates an error parsing or validating structure
58
+ // in raw format.
59
+ ErrRPCDeserialization RPCErrorCode = - 22
60
+
61
+ // ErrRPCVerify indicates a general error during transaction or block
62
+ // submission.
63
+ ErrRPCVerify RPCErrorCode = - 25
64
+
65
+ // ErrRPCVerifyRejected indicates that transaction or block was rejected by
66
+ // network rules.
67
+ ErrRPCVerifyRejected RPCErrorCode = - 26
68
+
69
+ // ErrRPCVerifyAlreadyInChain indicates that submitted transaction is
70
+ // already in chain.
71
+ ErrRPCVerifyAlreadyInChain RPCErrorCode = - 27
72
+
73
+ // ErrRPCInWarmup indicates that client is still warming up.
74
+ ErrRPCInWarmup RPCErrorCode = - 28
75
+
76
+ // ErrRPCInWarmup indicates that the RPC error is deprecated.
77
+ ErrRPCMethodDeprecated RPCErrorCode = - 32
43
78
)
44
79
45
80
// Peer-to-peer client errors.
46
81
const (
47
- ErrRPCClientNotConnected RPCErrorCode = - 9
82
+ // ErrRPCClientNotConnected indicates that Bitcoin is not connected.
83
+ ErrRPCClientNotConnected RPCErrorCode = - 9
84
+
85
+ // ErrRPCClientInInitialDownload indicates that client is still downloading
86
+ // initial blocks.
48
87
ErrRPCClientInInitialDownload RPCErrorCode = - 10
49
- ErrRPCClientNodeNotAdded RPCErrorCode = - 24
88
+
89
+ // ErrRPCClientNodeAlreadyAdded indicates that node is already added.
90
+ ErrRPCClientNodeAlreadyAdded RPCErrorCode = - 23
91
+
92
+ // ErrRPCClientNodeNotAdded indicates that node has not been added before.
93
+ ErrRPCClientNodeNotAdded RPCErrorCode = - 24
94
+
95
+ // ErrRPCClientNodeNotConnected indicates that node to disconnect was not
96
+ // found in connected nodes.
97
+ ErrRPCClientNodeNotConnected RPCErrorCode = - 29
98
+
99
+ // ErrRPCClientInvalidIPOrSubnet indicates an invalid IP/Subnet.
100
+ ErrRPCClientInvalidIPOrSubnet RPCErrorCode = - 30
101
+
102
+ // ErrRPCClientP2PDisabled indicates that no valid connection manager
103
+ // instance was found.
104
+ ErrRPCClientP2PDisabled RPCErrorCode = - 31
105
+ )
106
+
107
+ // Chain errors
108
+ const (
109
+ // ErrRPCClientMempoolDisabled indicates that no mempool instance was
110
+ // found.
111
+ ErrRPCClientMempoolDisabled RPCErrorCode = - 33
50
112
)
51
113
52
114
// Wallet JSON errors
53
115
const (
54
- ErrRPCWallet RPCErrorCode = - 4
55
- ErrRPCWalletInsufficientFunds RPCErrorCode = - 6
56
- ErrRPCWalletInvalidAccountName RPCErrorCode = - 11
57
- ErrRPCWalletKeypoolRanOut RPCErrorCode = - 12
58
- ErrRPCWalletUnlockNeeded RPCErrorCode = - 13
116
+ // ErrRPCWallet indicates an unspecified problem with wallet, for
117
+ // example, key not found, etc.
118
+ ErrRPCWallet RPCErrorCode = - 4
119
+
120
+ // ErrRPCWalletInsufficientFunds indicates that there are not enough
121
+ // funds in wallet or account.
122
+ ErrRPCWalletInsufficientFunds RPCErrorCode = - 6
123
+
124
+ // ErrRPCWalletInvalidAccountName indicates an invalid label name.
125
+ ErrRPCWalletInvalidAccountName RPCErrorCode = - 11
126
+
127
+ // ErrRPCWalletKeypoolRanOut indicates that the keypool ran out, and that
128
+ // keypoolrefill must be called first.
129
+ ErrRPCWalletKeypoolRanOut RPCErrorCode = - 12
130
+
131
+ // ErrRPCWalletUnlockNeeded indicates that the wallet passphrase must be
132
+ // entered first with the walletpassphrase RPC.
133
+ ErrRPCWalletUnlockNeeded RPCErrorCode = - 13
134
+
135
+ // ErrRPCWalletPassphraseIncorrect indicates that the wallet passphrase
136
+ // that was entered was incorrect.
59
137
ErrRPCWalletPassphraseIncorrect RPCErrorCode = - 14
60
- ErrRPCWalletWrongEncState RPCErrorCode = - 15
61
- ErrRPCWalletEncryptionFailed RPCErrorCode = - 16
62
- ErrRPCWalletAlreadyUnlocked RPCErrorCode = - 17
138
+
139
+ // ErrRPCWalletWrongEncState indicates that a command was given in wrong
140
+ // wallet encryption state, for example, encrypting an encrypted wallet.
141
+ ErrRPCWalletWrongEncState RPCErrorCode = - 15
142
+
143
+ // ErrRPCWalletEncryptionFailed indicates a failure to encrypt the wallet.
144
+ ErrRPCWalletEncryptionFailed RPCErrorCode = - 16
145
+
146
+ // ErrRPCWalletAlreadyUnlocked indicates an attempt to unlock a wallet
147
+ // that was already unlocked.
148
+ ErrRPCWalletAlreadyUnlocked RPCErrorCode = - 17
149
+
150
+ // ErrRPCWalletNotFound indicates that an invalid wallet was specified,
151
+ // which does not exist. It can also indicate an attempt to unload a
152
+ // wallet that was not previously loaded.
153
+ //
154
+ // Not to be confused with ErrRPCNoWallet, which is specific to btcd.
155
+ ErrRPCWalletNotFound RPCErrorCode = - 18
156
+
157
+ // ErrRPCWalletNotSpecified indicates that no wallet was specified, for
158
+ // example, when there are multiple wallets loaded.
159
+ ErrRPCWalletNotSpecified RPCErrorCode = - 19
63
160
)
64
161
65
162
// Specific Errors related to commands. These are the ones a user of the RPC
0 commit comments