More instantx->instantsend (few more ds->privatesend) (#984)
This commit is contained in:
parent
851b49aba0
commit
46744394a2
@ -13,7 +13,7 @@ class CCoinControl
|
|||||||
public:
|
public:
|
||||||
CTxDestination destChange;
|
CTxDestination destChange;
|
||||||
bool fUsePrivateSend;
|
bool fUsePrivateSend;
|
||||||
bool useInstantX;
|
bool fUseInstantSend;
|
||||||
//! If false, allows unselected inputs, but requires all selected inputs be used
|
//! If false, allows unselected inputs, but requires all selected inputs be used
|
||||||
bool fAllowOtherInputs;
|
bool fAllowOtherInputs;
|
||||||
//! Includes watch only addresses which match the ISMINE_WATCH_SOLVABLE criteria
|
//! Includes watch only addresses which match the ISMINE_WATCH_SOLVABLE criteria
|
||||||
@ -32,7 +32,7 @@ public:
|
|||||||
fAllowOtherInputs = false;
|
fAllowOtherInputs = false;
|
||||||
fAllowWatchOnly = false;
|
fAllowWatchOnly = false;
|
||||||
setSelected.clear();
|
setSelected.clear();
|
||||||
useInstantX = false;
|
fUseInstantSend = false;
|
||||||
fUsePrivateSend = true;
|
fUsePrivateSend = true;
|
||||||
nMinimumTotalFee = 0;
|
nMinimumTotalFee = 0;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ void ProcessMessageInstantSend(CNode* pfrom, std::string& strCommand, CDataStrea
|
|||||||
// Ignore any InstantSend messages until masternode list is synced
|
// Ignore any InstantSend messages until masternode list is synced
|
||||||
if(!masternodeSync.IsMasternodeListSynced()) return;
|
if(!masternodeSync.IsMasternodeListSynced()) return;
|
||||||
|
|
||||||
if (strCommand == NetMsgType::IX)
|
if (strCommand == NetMsgType::IX) // InstantSend Transaction Lock Request
|
||||||
{
|
{
|
||||||
//LogPrintf("ProcessMessageInstantSend\n");
|
//LogPrintf("ProcessMessageInstantSend\n");
|
||||||
CDataStream vMsg(vRecv);
|
CDataStream vMsg(vRecv);
|
||||||
@ -70,7 +70,7 @@ void ProcessMessageInstantSend(CNode* pfrom, std::string& strCommand, CDataStrea
|
|||||||
if(!IsInstantSendTxValid(tx)) return;
|
if(!IsInstantSendTxValid(tx)) return;
|
||||||
|
|
||||||
BOOST_FOREACH(const CTxOut o, tx.vout) {
|
BOOST_FOREACH(const CTxOut o, tx.vout) {
|
||||||
// IX supports normal scripts and unspendable scripts (used in DS collateral and Budget collateral).
|
// InstandSend supports normal scripts and unspendable scripts (used in PrivateSend collateral and Governance collateral).
|
||||||
// TODO: Look into other script types that are normal and can be included
|
// TODO: Look into other script types that are normal and can be included
|
||||||
if(!o.scriptPubKey.IsNormalPaymentScript() && !o.scriptPubKey.IsUnspendable()) {
|
if(!o.scriptPubKey.IsNormalPaymentScript() && !o.scriptPubKey.IsUnspendable()) {
|
||||||
LogPrintf("ProcessMessageInstantSend -- Invalid Script %s", tx.ToString());
|
LogPrintf("ProcessMessageInstantSend -- Invalid Script %s", tx.ToString());
|
||||||
@ -127,7 +127,7 @@ void ProcessMessageInstantSend(CNode* pfrom, std::string& strCommand, CDataStrea
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strCommand == NetMsgType::IXLOCKVOTE) //InstantX Lock Consensus Votes
|
else if (strCommand == NetMsgType::IXLOCKVOTE) // InstantSend Transaction Lock Consensus Votes
|
||||||
{
|
{
|
||||||
CConsensusVote vote;
|
CConsensusVote vote;
|
||||||
vRecv >> vote;
|
vRecv >> vote;
|
||||||
|
@ -17,7 +17,7 @@ class CTransactionLock;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
At 15 signatures, 1/2 of the masternode network can be owned by
|
At 15 signatures, 1/2 of the masternode network can be owned by
|
||||||
one party without comprimising the security of InstantX
|
one party without comprimising the security of InstantSend
|
||||||
(1000/2150.0)**10 = 0.00047382219560689856
|
(1000/2150.0)**10 = 0.00047382219560689856
|
||||||
(1000/2900.0)**10 = 2.3769498616783657e-05
|
(1000/2900.0)**10 = 2.3769498616783657e-05
|
||||||
|
|
||||||
|
@ -1087,7 +1087,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
|
|||||||
if (pool.exists(hash))
|
if (pool.exists(hash))
|
||||||
return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-in-mempool");
|
return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-in-mempool");
|
||||||
|
|
||||||
// ----------- instantX transaction scanning -----------
|
// ----------- InstantSend transaction scanning -----------
|
||||||
|
|
||||||
BOOST_FOREACH(const CTxIn& in, tx.vin){
|
BOOST_FOREACH(const CTxIn& in, tx.vin){
|
||||||
if(mapLockedInputs.count(in.prevout)){
|
if(mapLockedInputs.count(in.prevout)){
|
||||||
|
@ -607,7 +607,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
|||||||
nPayFee = coinControl->nMinimumTotalFee;
|
nPayFee = coinControl->nMinimumTotalFee;
|
||||||
|
|
||||||
// InstantSend Fee
|
// InstantSend Fee
|
||||||
if(coinControl->useInstantX) nPayFee = max(nPayFee, INSTANTSEND_MIN_FEE);
|
if (coinControl->fUseInstantSend) nPayFee = std::max(nPayFee, INSTANTSEND_MIN_FEE);
|
||||||
|
|
||||||
// Allow free? (require at least hard-coded threshold and default to that if no estimate)
|
// Allow free? (require at least hard-coded threshold and default to that if no estimate)
|
||||||
double dPriorityNeeded = std::max(mempoolEstimatePriority, AllowFreeThreshold());
|
double dPriorityNeeded = std::max(mempoolEstimatePriority, AllowFreeThreshold());
|
||||||
|
@ -1332,7 +1332,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkInstantX">
|
<widget class="QCheckBox" name="checkUseInstantSend">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1227,7 +1227,7 @@ padding-top:20px;
|
|||||||
padding-bottom:18px;
|
padding-bottom:18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDialog#SendCoinsDialog .QCheckBox#checkInstantX { /* InstantX Checkbox */
|
QDialog#SendCoinsDialog .QCheckBox#checkUseInstantSend { /* InstantSend Checkbox */
|
||||||
color:#555555;
|
color:#555555;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
background: qradialgradient(cx:0.5, cy:0.5, radius: 0.5, fx:0.5, fy:0.5, stop:0 rgba(248, 246, 246, 128), stop: 1 rgba(0, 0, 0, 0));
|
background: qradialgradient(cx:0.5, cy:0.5, radius: 0.5, fx:0.5, fy:0.5, stop:0 rgba(248, 246, 246, 128), stop: 1 rgba(0, 0, 0, 0));
|
||||||
|
@ -1211,7 +1211,7 @@ padding-top:20px;
|
|||||||
padding-bottom:18px;
|
padding-bottom:18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDialog#SendCoinsDialog .QCheckBox#checkInstantX { /* InstantX Checkbox */
|
QDialog#SendCoinsDialog .QCheckBox#checkUseInstantSend { /* InstantSend Checkbox */
|
||||||
color:#616161;
|
color:#616161;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
background: qradialgradient(cx:0.5, cy:0.5, radius: 0.5, fx:0.5, fy:0.5, stop:0 rgba(248, 246, 246, 128), stop: 1 rgba(0, 0, 0, 0));
|
background: qradialgradient(cx:0.5, cy:0.5, radius: 0.5, fx:0.5, fy:0.5, stop:0 rgba(248, 246, 246, 128), stop: 1 rgba(0, 0, 0, 0));
|
||||||
|
@ -1219,7 +1219,7 @@ padding-top:20px;
|
|||||||
padding-bottom:18px;
|
padding-bottom:18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDialog#SendCoinsDialog .QCheckBox#checkInstantX { /* InstantX Checkbox */
|
QDialog#SendCoinsDialog .QCheckBox#checkUseInstantSend { /* InstantSend Checkbox */
|
||||||
color:#616161;
|
color:#616161;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
background: qradialgradient(cx:0.5, cy:0.5, radius: 0.5, fx:0.5, fy:0.5, stop:0 rgba(248, 246, 246, 128), stop: 1 rgba(0, 0, 0, 0));
|
background: qradialgradient(cx:0.5, cy:0.5, radius: 0.5, fx:0.5, fy:0.5, stop:0 rgba(248, 246, 246, 128), stop: 1 rgba(0, 0, 0, 0));
|
||||||
|
@ -70,23 +70,23 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *platformStyle, QWidget *pa
|
|||||||
settings.setValue("bUseInstantX", false);
|
settings.setValue("bUseInstantX", false);
|
||||||
|
|
||||||
bool fUsePrivateSend = settings.value("bUseDarkSend").toBool();
|
bool fUsePrivateSend = settings.value("bUseDarkSend").toBool();
|
||||||
bool useInstantX = settings.value("bUseInstantX").toBool();
|
bool fUseInstantSend = settings.value("bUseInstantX").toBool();
|
||||||
if(fLiteMode) {
|
if(fLiteMode) {
|
||||||
ui->checkUsePrivateSend->setChecked(false);
|
ui->checkUsePrivateSend->setChecked(false);
|
||||||
ui->checkUsePrivateSend->setVisible(false);
|
ui->checkUsePrivateSend->setVisible(false);
|
||||||
ui->checkInstantX->setVisible(false);
|
ui->checkUseInstantSend->setVisible(false);
|
||||||
CoinControlDialog::coinControl->fUsePrivateSend = false;
|
CoinControlDialog::coinControl->fUsePrivateSend = false;
|
||||||
CoinControlDialog::coinControl->useInstantX = false;
|
CoinControlDialog::coinControl->fUseInstantSend = false;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ui->checkUsePrivateSend->setChecked(fUsePrivateSend);
|
ui->checkUsePrivateSend->setChecked(fUsePrivateSend);
|
||||||
ui->checkInstantX->setChecked(useInstantX);
|
ui->checkUseInstantSend->setChecked(fUseInstantSend);
|
||||||
CoinControlDialog::coinControl->fUsePrivateSend = fUsePrivateSend;
|
CoinControlDialog::coinControl->fUsePrivateSend = fUsePrivateSend;
|
||||||
CoinControlDialog::coinControl->useInstantX = useInstantX;
|
CoinControlDialog::coinControl->fUseInstantSend = fUseInstantSend;
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->checkUsePrivateSend, SIGNAL(stateChanged ( int )), this, SLOT(updateDisplayUnit()));
|
connect(ui->checkUsePrivateSend, SIGNAL(stateChanged ( int )), this, SLOT(updateDisplayUnit()));
|
||||||
connect(ui->checkInstantX, SIGNAL(stateChanged ( int )), this, SLOT(updateInstantX()));
|
connect(ui->checkUseInstantSend, SIGNAL(stateChanged ( int )), this, SLOT(updateInstantSend()));
|
||||||
|
|
||||||
// Coin Control: clipboard actions
|
// Coin Control: clipboard actions
|
||||||
QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this);
|
QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this);
|
||||||
@ -269,12 +269,12 @@ void SendCoinsDialog::on_sendButton_clicked()
|
|||||||
strFunds = tr("using") + " <b>" + tr("any available funds (not recommended)") + "</b>";
|
strFunds = tr("using") + " <b>" + tr("any available funds (not recommended)") + "</b>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ui->checkInstantX->isChecked()) {
|
if(ui->checkUseInstantSend->isChecked()) {
|
||||||
recipients[0].useInstantX = true;
|
recipients[0].fUseInstantSend = true;
|
||||||
strFunds += " ";
|
strFunds += " ";
|
||||||
strFunds += tr("and InstantSend");
|
strFunds += tr("and InstantSend");
|
||||||
} else {
|
} else {
|
||||||
recipients[0].useInstantX = false;
|
recipients[0].fUseInstantSend = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -599,11 +599,11 @@ void SendCoinsDialog::updateDisplayUnit()
|
|||||||
updateSmartFeeLabel();
|
updateSmartFeeLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendCoinsDialog::updateInstantX()
|
void SendCoinsDialog::updateInstantSend()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.setValue("bUseInstantX", ui->checkInstantX->isChecked());
|
settings.setValue("bUseInstantX", ui->checkUseInstantSend->isChecked());
|
||||||
CoinControlDialog::coinControl->useInstantX = ui->checkInstantX->isChecked();
|
CoinControlDialog::coinControl->fUseInstantSend = ui->checkUseInstantSend->isChecked();
|
||||||
coinControlUpdateLabels();
|
coinControlUpdateLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ private Q_SLOTS:
|
|||||||
void on_buttonMinimizeFee_clicked();
|
void on_buttonMinimizeFee_clicked();
|
||||||
void removeEntry(SendCoinsEntry* entry);
|
void removeEntry(SendCoinsEntry* entry);
|
||||||
void updateDisplayUnit();
|
void updateDisplayUnit();
|
||||||
void updateInstantX();
|
void updateInstantSend();
|
||||||
void coinControlFeatureChanged(bool);
|
void coinControlFeatureChanged(bool);
|
||||||
void coinControlButtonClicked();
|
void coinControlButtonClicked();
|
||||||
void coinControlChangeChecked(int);
|
void coinControlChangeChecked(int);
|
||||||
|
@ -294,18 +294,18 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
|
|||||||
CWalletTx *newTx = transaction.getTransaction();
|
CWalletTx *newTx = transaction.getTransaction();
|
||||||
CReserveKey *keyChange = transaction.getPossibleKeyChange();
|
CReserveKey *keyChange = transaction.getPossibleKeyChange();
|
||||||
|
|
||||||
if(recipients[0].useInstantX && total > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN){
|
if(recipients[0].fUseInstantSend && total > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN){
|
||||||
Q_EMIT message(tr("Send Coins"), tr("InstantSend doesn't support sending values that high yet. Transactions are currently limited to %1 DASH.").arg(sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)),
|
Q_EMIT message(tr("Send Coins"), tr("InstantSend doesn't support sending values that high yet. Transactions are currently limited to %1 DASH.").arg(sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)),
|
||||||
CClientUIInterface::MSG_ERROR);
|
CClientUIInterface::MSG_ERROR);
|
||||||
return TransactionCreationFailed;
|
return TransactionCreationFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, nChangePosRet, strFailReason, coinControl, true, recipients[0].inputType, recipients[0].useInstantX);
|
bool fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, nChangePosRet, strFailReason, coinControl, true, recipients[0].inputType, recipients[0].fUseInstantSend);
|
||||||
transaction.setTransactionFee(nFeeRequired);
|
transaction.setTransactionFee(nFeeRequired);
|
||||||
if (fSubtractFeeFromAmount && fCreated)
|
if (fSubtractFeeFromAmount && fCreated)
|
||||||
transaction.reassignAmounts(nChangePosRet);
|
transaction.reassignAmounts(nChangePosRet);
|
||||||
|
|
||||||
if(recipients[0].useInstantX && newTx->GetValueOut() > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN){
|
if(recipients[0].fUseInstantSend && newTx->GetValueOut() > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN){
|
||||||
Q_EMIT message(tr("Send Coins"), tr("InstantSend doesn't support sending values that high yet. Transactions are currently limited to %1 DASH.").arg(sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)),
|
Q_EMIT message(tr("Send Coins"), tr("InstantSend doesn't support sending values that high yet. Transactions are currently limited to %1 DASH.").arg(sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)),
|
||||||
CClientUIInterface::MSG_ERROR);
|
CClientUIInterface::MSG_ERROR);
|
||||||
return TransactionCreationFailed;
|
return TransactionCreationFailed;
|
||||||
@ -369,7 +369,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
|
|||||||
|
|
||||||
CReserveKey *keyChange = transaction.getPossibleKeyChange();
|
CReserveKey *keyChange = transaction.getPossibleKeyChange();
|
||||||
|
|
||||||
if(!wallet->CommitTransaction(*newTx, *keyChange, recipients[0].useInstantX ? NetMsgType::IX : NetMsgType::TX))
|
if(!wallet->CommitTransaction(*newTx, *keyChange, recipients[0].fUseInstantSend ? NetMsgType::IX : NetMsgType::TX))
|
||||||
return TransactionCommitFailed;
|
return TransactionCommitFailed;
|
||||||
|
|
||||||
CTransaction* t = (CTransaction*)newTx;
|
CTransaction* t = (CTransaction*)newTx;
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
QString address;
|
QString address;
|
||||||
QString label;
|
QString label;
|
||||||
AvailableCoinsType inputType;
|
AvailableCoinsType inputType;
|
||||||
bool useInstantX;
|
bool fUseInstantSend;
|
||||||
CAmount amount;
|
CAmount amount;
|
||||||
// If from a payment request, this is used for storing the memo
|
// If from a payment request, this is used for storing the memo
|
||||||
QString message;
|
QString message;
|
||||||
|
@ -371,7 +371,7 @@ UniValue getaddressesbyaccount(const UniValue& params, bool fHelp)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtractFeeFromAmount, CWalletTx& wtxNew, bool fUseIX=false, bool fUseDS=false)
|
static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtractFeeFromAmount, CWalletTx& wtxNew, bool fUseInstantSend=false, bool fUsePrivateSend=false)
|
||||||
{
|
{
|
||||||
CAmount curBalance = pwalletMain->GetBalance();
|
CAmount curBalance = pwalletMain->GetBalance();
|
||||||
|
|
||||||
@ -394,12 +394,12 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr
|
|||||||
CRecipient recipient = {scriptPubKey, nValue, fSubtractFeeFromAmount};
|
CRecipient recipient = {scriptPubKey, nValue, fSubtractFeeFromAmount};
|
||||||
vecSend.push_back(recipient);
|
vecSend.push_back(recipient);
|
||||||
if (!pwalletMain->CreateTransaction(vecSend, wtxNew, reservekey, nFeeRequired, nChangePosRet,
|
if (!pwalletMain->CreateTransaction(vecSend, wtxNew, reservekey, nFeeRequired, nChangePosRet,
|
||||||
strError, NULL, true, fUseDS ? ONLY_DENOMINATED : ALL_COINS, fUseIX)) {
|
strError, NULL, true, fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS, fUseInstantSend)) {
|
||||||
if (!fSubtractFeeFromAmount && nValue + nFeeRequired > pwalletMain->GetBalance())
|
if (!fSubtractFeeFromAmount && nValue + nFeeRequired > pwalletMain->GetBalance())
|
||||||
strError = strprintf("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!", FormatMoney(nFeeRequired));
|
strError = strprintf("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!", FormatMoney(nFeeRequired));
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, strError);
|
throw JSONRPCError(RPC_WALLET_ERROR, strError);
|
||||||
}
|
}
|
||||||
if (!pwalletMain->CommitTransaction(wtxNew, reservekey, fUseIX ? NetMsgType::IX : NetMsgType::TX))
|
if (!pwalletMain->CommitTransaction(wtxNew, reservekey, fUseInstantSend ? NetMsgType::IX : NetMsgType::TX))
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
|
throw JSONRPCError(RPC_WALLET_ERROR, "Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,16 +456,16 @@ UniValue sendtoaddress(const UniValue& params, bool fHelp)
|
|||||||
if (params.size() > 4)
|
if (params.size() > 4)
|
||||||
fSubtractFeeFromAmount = params[4].get_bool();
|
fSubtractFeeFromAmount = params[4].get_bool();
|
||||||
|
|
||||||
bool fUseIX = false;
|
bool fUseInstantSend = false;
|
||||||
bool fUseDS = false;
|
bool fUsePrivateSend = false;
|
||||||
if (params.size() > 5)
|
if (params.size() > 5)
|
||||||
fUseIX = params[5].get_bool();
|
fUseInstantSend = params[5].get_bool();
|
||||||
if (params.size() > 6)
|
if (params.size() > 6)
|
||||||
fUseDS = params[6].get_bool();
|
fUsePrivateSend = params[6].get_bool();
|
||||||
|
|
||||||
EnsureWalletIsUnlocked();
|
EnsureWalletIsUnlocked();
|
||||||
|
|
||||||
SendMoney(address.Get(), nAmount, fSubtractFeeFromAmount, wtx, fUseIX, fUseDS);
|
SendMoney(address.Get(), nAmount, fSubtractFeeFromAmount, wtx, fUseInstantSend, fUsePrivateSend);
|
||||||
|
|
||||||
return wtx.GetHash().GetHex();
|
return wtx.GetHash().GetHex();
|
||||||
}
|
}
|
||||||
@ -1112,18 +1112,18 @@ UniValue sendmany(const UniValue& params, bool fHelp)
|
|||||||
CAmount nFeeRequired = 0;
|
CAmount nFeeRequired = 0;
|
||||||
int nChangePosRet = -1;
|
int nChangePosRet = -1;
|
||||||
string strFailReason;
|
string strFailReason;
|
||||||
bool fUseIX = false;
|
bool fUseInstantSend = false;
|
||||||
bool fUseDS = false;
|
bool fUsePrivateSend = false;
|
||||||
if (params.size() > 5)
|
if (params.size() > 5)
|
||||||
fUseIX = params[5].get_bool();
|
fUseInstantSend = params[5].get_bool();
|
||||||
if (params.size() > 6)
|
if (params.size() > 6)
|
||||||
fUseDS = params[6].get_bool();
|
fUsePrivateSend = params[6].get_bool();
|
||||||
|
|
||||||
bool fCreated = pwalletMain->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, nChangePosRet, strFailReason,
|
bool fCreated = pwalletMain->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, nChangePosRet, strFailReason,
|
||||||
NULL, true, fUseDS ? ONLY_DENOMINATED : ALL_COINS, fUseIX);
|
NULL, true, fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS, fUseInstantSend);
|
||||||
if (!fCreated)
|
if (!fCreated)
|
||||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason);
|
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason);
|
||||||
if (!pwalletMain->CommitTransaction(wtx, keyChange, fUseIX ? NetMsgType::IX : NetMsgType::TX))
|
if (!pwalletMain->CommitTransaction(wtx, keyChange, fUseInstantSend ? NetMsgType::IX : NetMsgType::TX))
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Transaction commit failed");
|
throw JSONRPCError(RPC_WALLET_ERROR, "Transaction commit failed");
|
||||||
|
|
||||||
return wtx.GetHash().GetHex();
|
return wtx.GetHash().GetHex();
|
||||||
|
@ -2105,7 +2105,7 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const
|
|||||||
return nTotal;
|
return nTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, AvailableCoinsType coin_type, bool useIX) const
|
void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, AvailableCoinsType coin_type, bool fUseInstantSend) const
|
||||||
{
|
{
|
||||||
vCoins.clear();
|
vCoins.clear();
|
||||||
|
|
||||||
@ -2127,7 +2127,7 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
|
|||||||
|
|
||||||
int nDepth = pcoin->GetDepthInMainChain(false);
|
int nDepth = pcoin->GetDepthInMainChain(false);
|
||||||
// do not use IX for inputs that have less then 6 blockchain confirmations
|
// do not use IX for inputs that have less then 6 blockchain confirmations
|
||||||
if (useIX && nDepth < 6)
|
if (fUseInstantSend && nDepth < 6)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// We should not consider coins which aren't at least in our mempool
|
// We should not consider coins which aren't at least in our mempool
|
||||||
@ -2362,12 +2362,12 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, const CCoinControl* coinControl, AvailableCoinsType coin_type, bool useIX) const
|
bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, const CCoinControl* coinControl, AvailableCoinsType coin_type, bool fUseInstantSend) const
|
||||||
{
|
{
|
||||||
// Note: this function should never be used for "always free" tx types like dstx
|
// Note: this function should never be used for "always free" tx types like dstx
|
||||||
|
|
||||||
vector<COutput> vCoins;
|
vector<COutput> vCoins;
|
||||||
AvailableCoins(vCoins, true, coinControl, false, coin_type, useIX);
|
AvailableCoins(vCoins, true, coinControl, false, coin_type, fUseInstantSend);
|
||||||
|
|
||||||
// coin control -> return all selected outputs (we want all selected to go into the transaction for sure)
|
// coin control -> return all selected outputs (we want all selected to go into the transaction for sure)
|
||||||
if (coinControl && coinControl->HasSelected() && !coinControl->fAllowOtherInputs)
|
if (coinControl && coinControl->HasSelected() && !coinControl->fAllowOtherInputs)
|
||||||
@ -2910,17 +2910,17 @@ bool CWallet::CreateCollateralTransaction(CMutableTransaction& txCollateral, std
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::GetBudgetSystemCollateralTX(CTransaction& tx, uint256 hash, bool useIX)
|
bool CWallet::GetBudgetSystemCollateralTX(CTransaction& tx, uint256 hash, bool fUseInstantSend)
|
||||||
{
|
{
|
||||||
CWalletTx wtx;
|
CWalletTx wtx;
|
||||||
if(GetBudgetSystemCollateralTX(wtx, hash, useIX)){
|
if(GetBudgetSystemCollateralTX(wtx, hash, fUseInstantSend)){
|
||||||
tx = (CTransaction)wtx;
|
tx = (CTransaction)wtx;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, bool useIX)
|
bool CWallet::GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, bool fUseInstantSend)
|
||||||
{
|
{
|
||||||
// make our change address
|
// make our change address
|
||||||
CReserveKey reservekey(pwalletMain);
|
CReserveKey reservekey(pwalletMain);
|
||||||
@ -2935,7 +2935,7 @@ bool CWallet::GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, bool useI
|
|||||||
vecSend.push_back((CRecipient){scriptChange, GOVERNANCE_FEE_TX, false});
|
vecSend.push_back((CRecipient){scriptChange, GOVERNANCE_FEE_TX, false});
|
||||||
|
|
||||||
CCoinControl *coinControl=NULL;
|
CCoinControl *coinControl=NULL;
|
||||||
bool success = CreateTransaction(vecSend, tx, reservekey, nFeeRet, nChangePosRet, strFail, coinControl, true, ALL_COINS, useIX);
|
bool success = CreateTransaction(vecSend, tx, reservekey, nFeeRet, nChangePosRet, strFail, coinControl, true, ALL_COINS, fUseInstantSend);
|
||||||
if(!success){
|
if(!success){
|
||||||
LogPrintf("GetBudgetSystemCollateralTX: Error - %s\n", strFail);
|
LogPrintf("GetBudgetSystemCollateralTX: Error - %s\n", strFail);
|
||||||
return false;
|
return false;
|
||||||
@ -2962,9 +2962,9 @@ bool CWallet::ConvertList(std::vector<CTxIn> vCoins, std::vector<CAmount>& vecAm
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet,
|
bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet,
|
||||||
int& nChangePosRet, std::string& strFailReason, const CCoinControl* coinControl, bool sign, AvailableCoinsType coin_type, bool useIX)
|
int& nChangePosRet, std::string& strFailReason, const CCoinControl* coinControl, bool sign, AvailableCoinsType coin_type, bool fUseInstantSend)
|
||||||
{
|
{
|
||||||
CAmount nFeePay = useIX ? INSTANTSEND_MIN_FEE : 0;
|
CAmount nFeePay = fUseInstantSend ? INSTANTSEND_MIN_FEE : 0;
|
||||||
|
|
||||||
CAmount nValue = 0;
|
CAmount nValue = 0;
|
||||||
unsigned int nSubtractFeeFromAmount = 0;
|
unsigned int nSubtractFeeFromAmount = 0;
|
||||||
@ -3012,7 +3012,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
|||||||
// nLockTime that preclude a fix later.
|
// nLockTime that preclude a fix later.
|
||||||
|
|
||||||
// FIXME: "compatibility mode" for 12.0 IX, make it "txNew.nLockTime = chainActive.Height();" again in 12.2
|
// FIXME: "compatibility mode" for 12.0 IX, make it "txNew.nLockTime = chainActive.Height();" again in 12.2
|
||||||
txNew.nLockTime = useIX ? 0 : chainActive.Height();
|
txNew.nLockTime = fUseInstantSend ? 0 : chainActive.Height();
|
||||||
|
|
||||||
// Secondly occasionally randomly pick a nLockTime even further back, so
|
// Secondly occasionally randomly pick a nLockTime even further back, so
|
||||||
// that transactions that are delayed after signing for whatever reason,
|
// that transactions that are delayed after signing for whatever reason,
|
||||||
@ -3078,7 +3078,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
|||||||
set<pair<const CWalletTx*,unsigned int> > setCoins;
|
set<pair<const CWalletTx*,unsigned int> > setCoins;
|
||||||
CAmount nValueIn = 0;
|
CAmount nValueIn = 0;
|
||||||
|
|
||||||
if (!SelectCoins(nValueToSelect, setCoins, nValueIn, coinControl, coin_type, useIX))
|
if (!SelectCoins(nValueToSelect, setCoins, nValueIn, coinControl, coin_type, fUseInstantSend))
|
||||||
{
|
{
|
||||||
if(coin_type == ALL_COINS) {
|
if(coin_type == ALL_COINS) {
|
||||||
strFailReason = _("Insufficient funds.");
|
strFailReason = _("Insufficient funds.");
|
||||||
@ -3091,7 +3091,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
|||||||
strFailReason += " " + _("PrivateSend uses exact denominated amounts to send funds, you might simply need to anonymize some more coins.");
|
strFailReason += " " + _("PrivateSend uses exact denominated amounts to send funds, you might simply need to anonymize some more coins.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(useIX){
|
if(fUseInstantSend){
|
||||||
strFailReason += " " + _("InstantSend requires inputs with at least 6 confirmations, you might need to wait a few minutes and try again.");
|
strFailReason += " " + _("InstantSend requires inputs with at least 6 confirmations, you might need to wait a few minutes and try again.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ private:
|
|||||||
* all coins from coinControl are selected; Never select unconfirmed coins
|
* all coins from coinControl are selected; Never select unconfirmed coins
|
||||||
* if they are not ours
|
* if they are not ours
|
||||||
*/
|
*/
|
||||||
bool SelectCoins(const CAmount& nTargetValue, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, const CCoinControl *coinControl = NULL, AvailableCoinsType coin_type=ALL_COINS, bool useIX = true) const;
|
bool SelectCoins(const CAmount& nTargetValue, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, const CCoinControl *coinControl = NULL, AvailableCoinsType coin_type=ALL_COINS, bool fUseInstantSend = true) const;
|
||||||
|
|
||||||
CWalletDB *pwalletdbEncryption;
|
CWalletDB *pwalletdbEncryption;
|
||||||
|
|
||||||
@ -637,7 +637,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* populate vCoins with vector of available COutputs.
|
* populate vCoins with vector of available COutputs.
|
||||||
*/
|
*/
|
||||||
void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl = NULL, bool fIncludeZeroValue=false, AvailableCoinsType coin_type=ALL_COINS, bool useIX = false) const;
|
void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl = NULL, bool fIncludeZeroValue=false, AvailableCoinsType coin_type=ALL_COINS, bool fUseInstantSend = false) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shuffle and select coins until nTargetValue is reached while avoiding
|
* Shuffle and select coins until nTargetValue is reached while avoiding
|
||||||
@ -752,8 +752,8 @@ public:
|
|||||||
CAmount GetNeedsToBeAnonymizedBalance(CAmount nMinBalance = 0) const;
|
CAmount GetNeedsToBeAnonymizedBalance(CAmount nMinBalance = 0) const;
|
||||||
CAmount GetDenominatedBalance(bool unconfirmed=false) const;
|
CAmount GetDenominatedBalance(bool unconfirmed=false) const;
|
||||||
|
|
||||||
bool GetBudgetSystemCollateralTX(CTransaction& tx, uint256 hash, bool useIX);
|
bool GetBudgetSystemCollateralTX(CTransaction& tx, uint256 hash, bool fUseInstantSend);
|
||||||
bool GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, bool useIX);
|
bool GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, bool fUseInstantSend);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert additional inputs into the transaction by
|
* Insert additional inputs into the transaction by
|
||||||
@ -766,7 +766,7 @@ public:
|
|||||||
* selected by SelectCoins(); Also create the change output, when needed
|
* selected by SelectCoins(); Also create the change output, when needed
|
||||||
*/
|
*/
|
||||||
bool CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, int& nChangePosRet,
|
bool CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, int& nChangePosRet,
|
||||||
std::string& strFailReason, const CCoinControl *coinControl = NULL, bool sign = true, AvailableCoinsType coin_type=ALL_COINS, bool useIX=false);
|
std::string& strFailReason, const CCoinControl *coinControl = NULL, bool sign = true, AvailableCoinsType coin_type=ALL_COINS, bool fUseInstantSend=false);
|
||||||
bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey, std::string strCommand="tx");
|
bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey, std::string strCommand="tx");
|
||||||
|
|
||||||
std::string PrepareDarksendDenominate(int minRounds, int maxRounds);
|
std::string PrepareDarksendDenominate(int minRounds, int maxRounds);
|
||||||
|
Loading…
Reference in New Issue
Block a user