wallet: refactor GetNewDestination, use BResult

This commit is contained in:
furszy
2022-05-24 21:59:54 -03:00
parent 22351725bc
commit 111ea3ab71
13 changed files with 72 additions and 86 deletions

View File

@@ -69,15 +69,14 @@ struct FuzzedWallet {
CScript GetScriptPubKey(FuzzedDataProvider& fuzzed_data_provider)
{
auto type{fuzzed_data_provider.PickValueInArray(OUTPUT_TYPES)};
CTxDestination dest;
bilingual_str error;
BResult<CTxDestination> op_dest;
if (fuzzed_data_provider.ConsumeBool()) {
assert(wallet->GetNewDestination(type, "", dest, error));
op_dest = wallet->GetNewDestination(type, "");
} else {
assert(wallet->GetNewChangeDestination(type, dest, error));
op_dest = wallet->GetNewChangeDestination(type);
}
assert(error.empty());
return GetScriptForDestination(dest);
assert(op_dest.HasRes());
return GetScriptForDestination(op_dest.GetObj());
}
};