aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpc/addresses.cpp
diff options
context:
space:
mode:
authorfurszy <matiasfurszyfer@protonmail.com>2022-05-24 21:59:54 -0300
committerfurszy <matiasfurszyfer@protonmail.com>2022-07-08 11:18:35 -0300
commit111ea3ab711414236f8678566a7884d48619b2d8 (patch)
tree5d4fa02e5aeb208d51f268dec3e6bcf1350e0a98 /src/wallet/rpc/addresses.cpp
parent22351725bc4c5eb63ee45f607374bbf2d76e2b8c (diff)
downloadbitcoin-111ea3ab711414236f8678566a7884d48619b2d8.tar.xz
wallet: refactor GetNewDestination, use BResult
Diffstat (limited to 'src/wallet/rpc/addresses.cpp')
-rw-r--r--src/wallet/rpc/addresses.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp
index da4cc44ee6..9428d049de 100644
--- a/src/wallet/rpc/addresses.cpp
+++ b/src/wallet/rpc/addresses.cpp
@@ -58,13 +58,12 @@ RPCHelpMan getnewaddress()
output_type = parsed.value();
}
- CTxDestination dest;
- bilingual_str error;
- if (!pwallet->GetNewDestination(output_type, label, dest, error)) {
- throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, error.original);
+ auto op_dest = pwallet->GetNewDestination(output_type, label);
+ if (!op_dest) {
+ throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, op_dest.GetError().original);
}
- return EncodeDestination(dest);
+ return EncodeDestination(op_dest.GetObj());
},
};
}
@@ -106,12 +105,11 @@ RPCHelpMan getrawchangeaddress()
output_type = parsed.value();
}
- CTxDestination dest;
- bilingual_str error;
- if (!pwallet->GetNewChangeDestination(output_type, dest, error)) {
- throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, error.original);
+ auto op_dest = pwallet->GetNewChangeDestination(output_type);
+ if (!op_dest) {
+ throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, op_dest.GetError().original);
}
- return EncodeDestination(dest);
+ return EncodeDestination(op_dest.GetObj());
},
};
}