Skip to content

Commit

Permalink
Merge #1193: [GUI][Wallet] Allow spending of P2CS without coincontrol…
Browse files Browse the repository at this point in the history
… selection

b8e4df8 [GUI][Wallet] Allow spending of P2CS without coincontrol selection (random-zebra)

Pull request description:

  Currently in the owner wallet, when trying to send coins without selecting the inputs in coin-control, if the algo needs to select p2cs utxos (to reach the required input amount), the user is presented with "transaction creation failed" without any clue about the cause.
  This happens because the `fIncludeDelegated` flag of `CreateTransaction` is kept at its default false state in the model.

  This fixes it, setting the flag to `true`, thus allowing `AvailableCoins` to pick up p2cs owned utxos too.
  The user is still presented the warning whenever a coldstake utxo is about to be spent.

  Even though the cold-owner wallet is supposed to be offline (and not a wallet for regular spending), in the future we can modify the flow, presenting delegations locked by default and forcing the user to unlock them in coin-control, when he wants to spend them.

ACKs for top commit:
  Fuzzbawls:
    utACK b8e4df8
  Warrows:
    utACK b8e4df8
  furszy:
    Good, indeed fixing the issue. Tested ACK b8e4df8 .

Tree-SHA512: 23d7f4f8203427f4bc7f6148bc0670a9868f4141fa04d96ed4dd899797722164815a9056fd997b7b161feb31fa3f65a2c0a019324f95f48a83c4e55e920cd5c7
  • Loading branch information
furszy authored and Liquid369 committed Dec 13, 2019
1 parent 4c9c4aa commit 1922873
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,16 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
return TransactionCreationFailed;
}

bool fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, strFailReason, coinControl, recipients[0].inputType, recipients[0].useSwiftTX);
bool fCreated = wallet->CreateTransaction(vecSend,
*newTx,
*keyChange,
nFeeRequired,
strFailReason,
coinControl,
recipients[0].inputType,
recipients[0].useSwiftTX,
0,
true);
transaction.setTransactionFee(nFeeRequired);

if (recipients[0].useSwiftTX && newTx->GetValueOut() > sporkManager.GetSporkValue(SPORK_5_MAX_VALUE) * COIN) {
Expand Down

0 comments on commit 1922873

Please sign in to comment.