mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-26 23:09:03 +02:00
refactor: wallet: return util::Result from GetReservedDestination methods
This commit is contained in:
@@ -812,11 +812,13 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
|
||||
// Reserve a new key pair from key pool. If it fails, provide a dummy
|
||||
// destination in case we don't need change.
|
||||
CTxDestination dest;
|
||||
bilingual_str dest_err;
|
||||
if (!reservedest.GetReservedDestination(dest, true, dest_err)) {
|
||||
error = _("Transaction needs a change address, but we can't generate it.") + Untranslated(" ") + dest_err;
|
||||
auto op_dest = reservedest.GetReservedDestination(true);
|
||||
if (!op_dest) {
|
||||
error = _("Transaction needs a change address, but we can't generate it.") + Untranslated(" ") + util::ErrorString(op_dest);
|
||||
} else {
|
||||
dest = *op_dest;
|
||||
scriptChange = GetScriptForDestination(dest);
|
||||
}
|
||||
scriptChange = GetScriptForDestination(dest);
|
||||
// A valid destination implies a change script (and
|
||||
// vice-versa). An empty change script will abort later, if the
|
||||
// change keypool ran out, but change is required.
|
||||
|
||||
Reference in New Issue
Block a user