Fix JSON-RPC error code for walletpassphrase failures.
This commit is contained in:
parent
fbf744bc5e
commit
b7cef610c0
1 changed files with 6 additions and 3 deletions
|
@ -1460,7 +1460,7 @@ func jsonError(err error) *btcjson.RPCError {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var code btcjson.RPCErrorCode
|
code := btcjson.ErrRPCWallet
|
||||||
switch e := err.(type) {
|
switch e := err.(type) {
|
||||||
case btcjson.RPCError:
|
case btcjson.RPCError:
|
||||||
return &e
|
return &e
|
||||||
|
@ -1472,8 +1472,11 @@ func jsonError(err error) *btcjson.RPCError {
|
||||||
code = btcjson.ErrRPCInvalidParameter
|
code = btcjson.ErrRPCInvalidParameter
|
||||||
case ParseError:
|
case ParseError:
|
||||||
code = btcjson.ErrRPCParse.Code
|
code = btcjson.ErrRPCParse.Code
|
||||||
default: // All other errors get the wallet error code.
|
case waddrmgr.ManagerError:
|
||||||
code = btcjson.ErrRPCWallet
|
switch e.ErrorCode {
|
||||||
|
case waddrmgr.ErrWrongPassphrase:
|
||||||
|
code = btcjson.ErrRPCWalletPassphraseIncorrect
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return &btcjson.RPCError{
|
return &btcjson.RPCError{
|
||||||
Code: code,
|
Code: code,
|
||||||
|
|
Loading…
Reference in a new issue