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

@@ -74,11 +74,9 @@ static void add_coin(std::vector<COutput>& coins, CWallet& wallet, const CAmount
tx.vout.resize(nInput + 1);
tx.vout[nInput].nValue = nValue;
if (spendable) {
CTxDestination dest;
bilingual_str error;
const bool destination_ok = wallet.GetNewDestination(OutputType::BECH32, "", dest, error);
assert(destination_ok);
tx.vout[nInput].scriptPubKey = GetScriptForDestination(dest);
auto op_dest = wallet.GetNewDestination(OutputType::BECH32, "");
assert(op_dest.HasRes());
tx.vout[nInput].scriptPubKey = GetScriptForDestination(op_dest.GetObj());
}
uint256 txid = tx.GetHash();