diff --git a/src/qt/assetsdialog.cpp b/src/qt/assetsdialog.cpp index 1f2afec9cb..e0a4cb3ea3 100644 --- a/src/qt/assetsdialog.cpp +++ b/src/qt/assetsdialog.cpp @@ -118,7 +118,6 @@ AssetsDialog::AssetsDialog(const PlatformStyle *_platformStyle, QWidget *parent) /** RVN START */ connect(ui->createAssetButton, SIGNAL(clicked()), this, SLOT(createAssetButtonClicked())); connect(ui->reissueAssetButton, SIGNAL(clicked()), this, SLOT(reissueAssetButtonClicked())); - ui->optInRBF->hide(); // If the network is regtest. Add some helper buttons to the asset GUI if (Params().NetworkIDString() != "regtest") { @@ -188,15 +187,16 @@ void AssetsDialog::setModel(WalletModel *_model) connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(setMinimumFee())); connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateFeeSectionControls())); connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(assetControlUpdateLabels())); - connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(updateSmartFeeLabel())); - connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(assetControlUpdateLabels())); +// connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(updateSmartFeeLabel())); +// connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(assetControlUpdateLabels())); ui->customFee->setSingleStep(GetRequiredFee(1000)); updateFeeSectionControls(); updateMinFeeLabel(); updateSmartFeeLabel(); // set default rbf checkbox state - ui->optInRBF->setCheckState(model->getDefaultWalletRbf() ? Qt::Checked : Qt::Unchecked); +// ui->optInRBF->setCheckState(model->getDefaultWalletRbf() ? Qt::Checked : Qt::Unchecked); + ui->optInRBF->hide(); // set the smartfee-sliders default value (wallets default conf.target or last stored value) QSettings settings; @@ -341,12 +341,12 @@ void AssetsDialog::on_sendButton_clicked() questionString.append(" (" + QString::number((double)GetVirtualTransactionSize(tx) / 1000) + " kB)"); } - if (ui->optInRBF->isChecked()) - { - questionString.append("
"); - questionString.append(tr("This transaction signals replaceability (optin-RBF).")); - questionString.append(""); - } +// if (ui->optInRBF->isChecked()) +// { +// questionString.append("
"); +// questionString.append(tr("This transaction signals replaceability (optin-RBF).")); +// questionString.append(""); +// } SendConfirmationDialog confirmationDialog(tr("Confirm send assets"), questionString.arg(formatted.join("
")), SEND_CONFIRM_DELAY, this); @@ -673,7 +673,7 @@ void AssetsDialog::updateAssetControlState(CCoinControl& ctrl) // Avoid using global defaults when sending money from the GUI // Either custom fee will be used or if not selected, the confirmation target from dropdown box ctrl.m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex()); - ctrl.signalRbf = ui->optInRBF->isChecked(); +// ctrl.signalRbf = ui->optInRBF->isChecked(); } void AssetsDialog::updateSmartFeeLabel() diff --git a/src/qt/createassetdialog.cpp b/src/qt/createassetdialog.cpp index f54f89f6cb..dfb3ab1c30 100644 --- a/src/qt/createassetdialog.cpp +++ b/src/qt/createassetdialog.cpp @@ -155,15 +155,16 @@ void CreateAssetDialog::setModel(WalletModel *_model) connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(setMinimumFee())); connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateFeeSectionControls())); connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); - connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(updateSmartFeeLabel())); - connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); +// connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(updateSmartFeeLabel())); +// connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); ui->customFee->setSingleStep(GetRequiredFee(1000)); updateFeeSectionControls(); updateMinFeeLabel(); updateSmartFeeLabel(); // set default rbf checkbox state - ui->optInRBF->setCheckState(model->getDefaultWalletRbf() ? Qt::Checked : Qt::Unchecked); +// ui->optInRBF->setCheckState(model->getDefaultWalletRbf() ? Qt::Checked : Qt::Unchecked); + ui->optInRBF->hide(); // set the smartfee-sliders default value (wallets default conf.target or last stored value) QSettings settings; @@ -728,7 +729,7 @@ void CreateAssetDialog::updateCoinControlState(CCoinControl& ctrl) // Avoid using global defaults when sending money from the GUI // Either custom fee will be used or if not selected, the confirmation target from dropdown box ctrl.m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex()); - ctrl.signalRbf = ui->optInRBF->isChecked(); +// ctrl.signalRbf = ui->optInRBF->isChecked(); } void CreateAssetDialog::updateSmartFeeLabel() diff --git a/src/qt/reissueassetdialog.cpp b/src/qt/reissueassetdialog.cpp index f3a6b72443..5bf7a69129 100644 --- a/src/qt/reissueassetdialog.cpp +++ b/src/qt/reissueassetdialog.cpp @@ -159,15 +159,16 @@ void ReissueAssetDialog::setModel(WalletModel *_model) connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(setMinimumFee())); connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateFeeSectionControls())); connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); - connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(updateSmartFeeLabel())); - connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); +// connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(updateSmartFeeLabel())); +// connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); ui->customFee->setSingleStep(GetRequiredFee(1000)); updateFeeSectionControls(); updateMinFeeLabel(); updateSmartFeeLabel(); // set default rbf checkbox state - ui->optInRBF->setCheckState(model->getDefaultWalletRbf() ? Qt::Checked : Qt::Unchecked); +// ui->optInRBF->setCheckState(model->getDefaultWalletRbf() ? Qt::Checked : Qt::Unchecked); + ui->optInRBF->hide(); // set the smartfee-sliders default value (wallets default conf.target or last stored value) QSettings settings; @@ -716,7 +717,7 @@ void ReissueAssetDialog::updateCoinControlState(CCoinControl& ctrl) // Avoid using global defaults when sending money from the GUI // Either custom fee will be used or if not selected, the confirmation target from dropdown box ctrl.m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex()); - ctrl.signalRbf = ui->optInRBF->isChecked(); +// ctrl.signalRbf = ui->optInRBF->isChecked(); } void ReissueAssetDialog::updateSmartFeeLabel() diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 8997cda6fc..36c7e10a05 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -158,15 +158,16 @@ void SendCoinsDialog::setModel(WalletModel *_model) connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(setMinimumFee())); connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateFeeSectionControls())); connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); - connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(updateSmartFeeLabel())); - connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); +// connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(updateSmartFeeLabel())); +// connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); ui->customFee->setSingleStep(GetRequiredFee(1000)); updateFeeSectionControls(); updateMinFeeLabel(); updateSmartFeeLabel(); // set default rbf checkbox state - ui->optInRBF->setCheckState(model->getDefaultWalletRbf() ? Qt::Checked : Qt::Unchecked); +// ui->optInRBF->setCheckState(model->getDefaultWalletRbf() ? Qt::Checked : Qt::Unchecked); + ui->optInRBF->hide(); // set the smartfee-sliders default value (wallets default conf.target or last stored value) QSettings settings; @@ -324,12 +325,12 @@ void SendCoinsDialog::on_sendButton_clicked() questionString.append(QString("
(=%2)
") .arg(alternativeUnits.join(" " + tr("or") + "
"))); - if (ui->optInRBF->isChecked()) - { - questionString.append("
"); - questionString.append(tr("This transaction signals replaceability (optin-RBF).")); - questionString.append(""); - } +// if (ui->optInRBF->isChecked()) +// { +// questionString.append("
"); +// questionString.append(tr("This transaction signals replaceability (optin-RBF).")); +// questionString.append(""); +// } SendConfirmationDialog confirmationDialog(tr("Confirm send coins"), questionString.arg(formatted.join("
")), SEND_CONFIRM_DELAY, this); @@ -629,7 +630,7 @@ void SendCoinsDialog::updateCoinControlState(CCoinControl& ctrl) // Avoid using global defaults when sending money from the GUI // Either custom fee will be used or if not selected, the confirmation target from dropdown box ctrl.m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex()); - ctrl.signalRbf = ui->optInRBF->isChecked(); +// ctrl.signalRbf = ui->optInRBF->isChecked(); } void SendCoinsDialog::updateSmartFeeLabel() diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index e36d6ab5ff..d10c03f421 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -167,8 +167,8 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa // Actions abandonAction = new QAction(tr("Abandon transaction"), this); - bumpFeeAction = new QAction(tr("Increase transaction fee"), this); - bumpFeeAction->setObjectName("bumpFeeAction"); +// bumpFeeAction = new QAction(tr("Increase transaction fee"), this); +// bumpFeeAction->setObjectName("bumpFeeAction"); QAction *copyAddressAction = new QAction(tr("Copy address"), this); QAction *copyLabelAction = new QAction(tr("Copy label"), this); QAction *copyAmountAction = new QAction(tr("Copy amount"), this); @@ -188,7 +188,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa contextMenu->addAction(copyTxPlainText); contextMenu->addAction(showDetailsAction); contextMenu->addSeparator(); - contextMenu->addAction(bumpFeeAction); +// contextMenu->addAction(bumpFeeAction); contextMenu->addAction(abandonAction); contextMenu->addAction(editLabelAction); @@ -210,7 +210,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex))); connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); - connect(bumpFeeAction, SIGNAL(triggered()), this, SLOT(bumpFee())); +// connect(bumpFeeAction, SIGNAL(triggered()), this, SLOT(bumpFee())); connect(abandonAction, SIGNAL(triggered()), this, SLOT(abandonTx())); connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); @@ -450,7 +450,7 @@ void TransactionView::contextualMenu(const QPoint &point) uint256 hash; hash.SetHex(selection.at(0).data(TransactionTableModel::TxHashRole).toString().toStdString()); abandonAction->setEnabled(model->transactionCanBeAbandoned(hash)); - bumpFeeAction->setEnabled(model->transactionCanBeBumped(hash)); +// bumpFeeAction->setEnabled(model->transactionCanBeBumped(hash)); if(index.isValid()) { diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index ccf2511ae8..2d80939dfe 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -748,82 +748,85 @@ bool WalletModel::abandonTransaction(uint256 hash) const bool WalletModel::transactionCanBeBumped(uint256 hash) const { - LOCK2(cs_main, wallet->cs_wallet); - const CWalletTx *wtx = wallet->GetWalletTx(hash); - return wtx && SignalsOptInRBF(*wtx) && !wtx->mapValue.count("replaced_by_txid"); + return false; + // For now, remove the ability to bump a transaction. Always return false. +// LOCK2(cs_main, wallet->cs_wallet); +// const CWalletTx *wtx = wallet->GetWalletTx(hash); +// return wtx && SignalsOptInRBF(*wtx) && !wtx->mapValue.count("replaced_by_txid"); } bool WalletModel::bumpFee(uint256 hash) { - std::unique_ptr feeBump; - { - CCoinControl coin_control; - coin_control.signalRbf = true; - LOCK2(cs_main, wallet->cs_wallet); - feeBump.reset(new CFeeBumper(wallet, hash, coin_control, 0)); - } - if (feeBump->getResult() != BumpFeeResult::OK) - { - QMessageBox::critical(0, tr("Fee bump error"), tr("Increasing transaction fee failed") + "
(" + - (feeBump->getErrors().size() ? QString::fromStdString(feeBump->getErrors()[0]) : "") +")"); - return false; - } - - // allow a user based fee verification - QString questionString = tr("Do you want to increase the fee?"); - questionString.append("
"); - CAmount oldFee = feeBump->getOldFee(); - CAmount newFee = feeBump->getNewFee(); - questionString.append(""); - questionString.append("
"); - questionString.append(tr("Current fee:")); - questionString.append(""); - questionString.append(RavenUnits::formatHtmlWithUnit(getOptionsModel()->getDisplayUnit(), oldFee)); - questionString.append("
"); - questionString.append(tr("Increase:")); - questionString.append(""); - questionString.append(RavenUnits::formatHtmlWithUnit(getOptionsModel()->getDisplayUnit(), newFee - oldFee)); - questionString.append("
"); - questionString.append(tr("New fee:")); - questionString.append(""); - questionString.append(RavenUnits::formatHtmlWithUnit(getOptionsModel()->getDisplayUnit(), newFee)); - questionString.append("
"); - SendConfirmationDialog confirmationDialog(tr("Confirm fee bump"), questionString); - confirmationDialog.exec(); - QMessageBox::StandardButton retval = (QMessageBox::StandardButton)confirmationDialog.result(); - - // cancel sign&broadcast if users doesn't want to bump the fee - if (retval != QMessageBox::Yes) { - return false; - } - - WalletModel::UnlockContext ctx(requestUnlock()); - if(!ctx.isValid()) - { - return false; - } - - // sign bumped transaction - bool res = false; - { - LOCK2(cs_main, wallet->cs_wallet); - res = feeBump->signTransaction(wallet); - } - if (!res) { - QMessageBox::critical(0, tr("Fee bump error"), tr("Can't sign transaction.")); - return false; - } - // commit the bumped transaction - { - LOCK2(cs_main, wallet->cs_wallet); - res = feeBump->commit(wallet); - } - if(!res) { - QMessageBox::critical(0, tr("Fee bump error"), tr("Could not commit transaction") + "
(" + - QString::fromStdString(feeBump->getErrors()[0])+")"); - return false; - } - return true; + return false; +// std::unique_ptr feeBump; +// { +// CCoinControl coin_control; +// coin_control.signalRbf = true; +// LOCK2(cs_main, wallet->cs_wallet); +// feeBump.reset(new CFeeBumper(wallet, hash, coin_control, 0)); +// } +// if (feeBump->getResult() != BumpFeeResult::OK) +// { +// QMessageBox::critical(0, tr("Fee bump error"), tr("Increasing transaction fee failed") + "
(" + +// (feeBump->getErrors().size() ? QString::fromStdString(feeBump->getErrors()[0]) : "") +")"); +// return false; +// } +// +// // allow a user based fee verification +// QString questionString = tr("Do you want to increase the fee?"); +// questionString.append("
"); +// CAmount oldFee = feeBump->getOldFee(); +// CAmount newFee = feeBump->getNewFee(); +// questionString.append(""); +// questionString.append("
"); +// questionString.append(tr("Current fee:")); +// questionString.append(""); +// questionString.append(RavenUnits::formatHtmlWithUnit(getOptionsModel()->getDisplayUnit(), oldFee)); +// questionString.append("
"); +// questionString.append(tr("Increase:")); +// questionString.append(""); +// questionString.append(RavenUnits::formatHtmlWithUnit(getOptionsModel()->getDisplayUnit(), newFee - oldFee)); +// questionString.append("
"); +// questionString.append(tr("New fee:")); +// questionString.append(""); +// questionString.append(RavenUnits::formatHtmlWithUnit(getOptionsModel()->getDisplayUnit(), newFee)); +// questionString.append("
"); +// SendConfirmationDialog confirmationDialog(tr("Confirm fee bump"), questionString); +// confirmationDialog.exec(); +// QMessageBox::StandardButton retval = (QMessageBox::StandardButton)confirmationDialog.result(); +// +// // cancel sign&broadcast if users doesn't want to bump the fee +// if (retval != QMessageBox::Yes) { +// return false; +// } +// +// WalletModel::UnlockContext ctx(requestUnlock()); +// if(!ctx.isValid()) +// { +// return false; +// } +// +// // sign bumped transaction +// bool res = false; +// { +// LOCK2(cs_main, wallet->cs_wallet); +// res = feeBump->signTransaction(wallet); +// } +// if (!res) { +// QMessageBox::critical(0, tr("Fee bump error"), tr("Can't sign transaction.")); +// return false; +// } +// // commit the bumped transaction +// { +// LOCK2(cs_main, wallet->cs_wallet); +// res = feeBump->commit(wallet); +// } +// if(!res) { +// QMessageBox::critical(0, tr("Fee bump error"), tr("Could not commit transaction") + "
(" + +// QString::fromStdString(feeBump->getErrors()[0])+")"); +// return false; +// } +// return true; } bool WalletModel::isWalletEnabled() diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index b9ec3e8224..4d78cf7b8f 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -56,8 +56,8 @@ static const CRPCConvertParam vRPCConvertParams[] = { "getnetworkhashps", 1, "height" }, { "sendtoaddress", 1, "amount" }, { "sendtoaddress", 4, "subtractfeefromamount" }, - { "sendtoaddress", 5 , "replaceable" }, - { "sendtoaddress", 6 , "conf_target" }, +// { "sendtoaddress", 5 , "replaceable" }, + { "sendtoaddress", 5 , "conf_target" }, { "settxfee", 0, "amount" }, { "getreceivedbyaddress", 1, "minconf" }, { "getreceivedbyaccount", 1, "minconf" }, @@ -91,8 +91,8 @@ static const CRPCConvertParam vRPCConvertParams[] = { "sendmany", 1, "amounts" }, { "sendmany", 2, "minconf" }, { "sendmany", 4, "subtractfeefrom" }, - { "sendmany", 5 , "replaceable" }, - { "sendmany", 6 , "conf_target" }, +// { "sendmany", 5 , "replaceable" }, + { "sendmany", 5 , "conf_target" }, { "addmultisigaddress", 0, "nrequired" }, { "addmultisigaddress", 1, "keys" }, { "createmultisig", 0, "nrequired" }, @@ -111,7 +111,7 @@ static const CRPCConvertParam vRPCConvertParams[] = { "createrawtransaction", 0, "inputs" }, { "createrawtransaction", 1, "outputs" }, { "createrawtransaction", 2, "locktime" }, - { "createrawtransaction", 3, "replaceable" }, +// { "createrawtransaction", 3, "replaceable" }, { "signrawtransaction", 1, "prevtxs" }, { "signrawtransaction", 2, "privkeys" }, { "sendrawtransaction", 1, "allowhighfees" }, diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index b597305784..3c2c94cd1c 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -343,7 +343,7 @@ UniValue verifytxoutproof(const JSONRPCRequest& request) UniValue createrawtransaction(const JSONRPCRequest& request) { - if (request.fHelp || request.params.size() < 2 || request.params.size() > 4) + if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) throw std::runtime_error( "createrawtransaction [{\"txid\":\"id\",\"vout\":n},...] {\"address\":(amount or object),\"data\":\"hex\",...} ( locktime ) ( replaceable )\n" "\nCreate a transaction spending the given inputs and creating new outputs.\n" @@ -430,9 +430,9 @@ UniValue createrawtransaction(const JSONRPCRequest& request) " ,...\n" " }\n" "3. locktime (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs\n" - "4. replaceable (boolean, optional, default=false) Marks this transaction as BIP125 replaceable.\n" - " Allows this transaction to be replaced by a transaction with higher fees.\n" - " If provided, it is an error if explicit sequence numbers are incompatible.\n" +// "4. replaceable (boolean, optional, default=false) Marks this transaction as BIP125 replaceable.\n" +// " Allows this transaction to be replaced by a transaction with higher fees.\n" +// " If provided, it is an error if explicit sequence numbers are incompatible.\n" "\nResult:\n" "\"transaction\" (string) hex string of the transaction\n" @@ -462,7 +462,7 @@ UniValue createrawtransaction(const JSONRPCRequest& request) rawTx.nLockTime = nLockTime; } - bool rbfOptIn = request.params[3].isTrue(); +// bool rbfOptIn = request.params[3].isTrue(); for (unsigned int idx = 0; idx < inputs.size(); idx++) { const UniValue& input = inputs[idx]; @@ -478,9 +478,15 @@ UniValue createrawtransaction(const JSONRPCRequest& request) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive"); uint32_t nSequence; - if (rbfOptIn) { - nSequence = MAX_BIP125_RBF_SEQUENCE; - } else if (rawTx.nLockTime) { +// if (rbfOptIn) { +// nSequence = MAX_BIP125_RBF_SEQUENCE; +// } else if (rawTx.nLockTime) { +// nSequence = std::numeric_limits::max() - 1; +// } else { +// nSequence = std::numeric_limits::max(); +// } + + if (rawTx.nLockTime) { nSequence = std::numeric_limits::max() - 1; } else { nSequence = std::numeric_limits::max(); @@ -775,9 +781,9 @@ UniValue createrawtransaction(const JSONRPCRequest& request) } } - if (!request.params[3].isNull() && rbfOptIn != SignalsOptInRBF(rawTx)) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter combination: Sequence number(s) contradict replaceable option"); - } +// if (!request.params[3].isNull() && rbfOptIn != SignalsOptInRBF(rawTx)) { +// throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter combination: Sequence number(s) contradict replaceable option"); +// } return EncodeHexTx(rawTx); } @@ -1413,7 +1419,7 @@ static const CRPCCommand commands[] = { // category name actor (function) argNames // --------------------- ------------------------ ----------------------- ---------- { "rawtransactions", "getrawtransaction", &getrawtransaction, {"txid","verbose"} }, - { "rawtransactions", "createrawtransaction", &createrawtransaction, {"inputs","outputs","locktime","replaceable"} }, + { "rawtransactions", "createrawtransaction", &createrawtransaction, {"inputs","outputs","locktime"} }, { "rawtransactions", "decoderawtransaction", &decoderawtransaction, {"hexstring"} }, { "rawtransactions", "decodescript", &decodescript, {"hexstring"} }, { "rawtransactions", "sendrawtransaction", &sendrawtransaction, {"hexstring","allowhighfees"} }, diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index cae178cdfa..1bf0748212 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -426,7 +426,7 @@ UniValue sendtoaddress(const JSONRPCRequest& request) return NullUniValue; } - if (request.fHelp || request.params.size() < 2 || request.params.size() > 8) + if (request.fHelp || request.params.size() < 2 || request.params.size() > 7) throw std::runtime_error( "sendtoaddress \"address\" amount ( \"comment\" \"comment_to\" subtractfeefromamount replaceable conf_target \"estimate_mode\")\n" "\nSend an amount to a given address.\n" @@ -441,9 +441,9 @@ UniValue sendtoaddress(const JSONRPCRequest& request) " transaction, just kept in your wallet.\n" "5. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.\n" " The recipient will receive less ravens than you enter in the amount field.\n" - "6. replaceable (boolean, optional) Allow this transaction to be replaced by a transaction with higher fees via BIP 125\n" - "7. conf_target (numeric, optional) Confirmation target (in blocks)\n" - "8. \"estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n" +// "6. replaceable (boolean, optional) Allow this transaction to be replaced by a transaction with higher fees via BIP 125\n" + "6. conf_target (numeric, optional) Confirmation target (in blocks)\n" + "7. \"estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n" " \"UNSET\"\n" " \"ECONOMICAL\"\n" " \"CONSERVATIVE\"\n" @@ -482,15 +482,15 @@ UniValue sendtoaddress(const JSONRPCRequest& request) } CCoinControl coin_control; - if (!request.params[5].isNull()) { - coin_control.signalRbf = request.params[5].get_bool(); - } +// if (!request.params[5].isNull()) { +// coin_control.signalRbf = request.params[5].get_bool(); +// } - if (!request.params[6].isNull()) { + if (!request.params[5].isNull()) { coin_control.m_confirm_target = ParseConfirmTarget(request.params[6]); } - if (!request.params[7].isNull()) { + if (!request.params[6].isNull()) { if (!FeeModeFromString(request.params[7].get_str(), coin_control.m_fee_mode)) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter"); } @@ -985,9 +985,9 @@ UniValue sendmany(const JSONRPCRequest& request) " \"address\" (string) Subtract fee from this address\n" " ,...\n" " ]\n" - "6. replaceable (boolean, optional) Allow this transaction to be replaced by a transaction with higher fees via BIP 125\n" - "7. conf_target (numeric, optional) Confirmation target (in blocks)\n" - "8. \"estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n" +// "6. replaceable (boolean, optional) Allow this transaction to be replaced by a transaction with higher fees via BIP 125\n" + "6. conf_target (numeric, optional) Confirmation target (in blocks)\n" + "7. \"estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n" " \"UNSET\"\n" " \"ECONOMICAL\"\n" " \"CONSERVATIVE\"\n" @@ -1028,15 +1028,15 @@ UniValue sendmany(const JSONRPCRequest& request) subtractFeeFromAmount = request.params[4].get_array(); CCoinControl coin_control; - if (!request.params[5].isNull()) { - coin_control.signalRbf = request.params[5].get_bool(); - } +// if (!request.params[5].isNull()) { +// coin_control.signalRbf = request.params[5].get_bool(); +// } - if (!request.params[6].isNull()) { + if (!request.params[5].isNull()) { coin_control.m_confirm_target = ParseConfirmTarget(request.params[6]); } - if (!request.params[7].isNull()) { + if (!request.params[6].isNull()) { if (!FeeModeFromString(request.params[7].get_str(), coin_control.m_fee_mode)) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter"); } @@ -2911,7 +2911,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request) " Those recipients will receive less ravens than you enter in their corresponding amount field.\n" " If no outputs are specified here, the sender pays the fee.\n" " [vout_index,...]\n" - " \"replaceable\" (boolean, optional) Marks this transaction as BIP125 replaceable.\n" +// " \"replaceable\" (boolean, optional) Marks this transaction as BIP125 replaceable.\n" " Allows this transaction to be replaced by a transaction with higher fees\n" " \"conf_target\" (numeric, optional) Confirmation target (in blocks)\n" " \"estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n" @@ -2965,7 +2965,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request) {"reserveChangeKey", UniValueType(UniValue::VBOOL)}, // DEPRECATED (and ignored), should be removed in 0.16 or so. {"feeRate", UniValueType()}, // will be checked below {"subtractFeeFromOutputs", UniValueType(UniValue::VARR)}, - {"replaceable", UniValueType(UniValue::VBOOL)}, +// {"replaceable", UniValueType(UniValue::VBOOL)}, {"conf_target", UniValueType(UniValue::VNUM)}, {"estimate_mode", UniValueType(UniValue::VSTR)}, }, @@ -2999,9 +2999,9 @@ UniValue fundrawtransaction(const JSONRPCRequest& request) if (options.exists("subtractFeeFromOutputs")) subtractFeeFromOutputs = options["subtractFeeFromOutputs"].get_array(); - if (options.exists("replaceable")) { - coinControl.signalRbf = options["replaceable"].get_bool(); - } +// if (options.exists("replaceable")) { +// coinControl.signalRbf = options["replaceable"].get_bool(); +// } if (options.exists("conf_target")) { if (options.exists("feeRate")) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot specify both conf_target and feeRate"); @@ -3058,142 +3058,144 @@ UniValue fundrawtransaction(const JSONRPCRequest& request) UniValue bumpfee(const JSONRPCRequest& request) { - CWallet * const pwallet = GetWalletForJSONRPCRequest(request); - - if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) - return NullUniValue; - - if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { - throw std::runtime_error( - "bumpfee \"txid\" ( options ) \n" - "\nBumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B.\n" - "An opt-in RBF transaction with the given txid must be in the wallet.\n" - "The command will pay the additional fee by decreasing (or perhaps removing) its change output.\n" - "If the change output is not big enough to cover the increased fee, the command will currently fail\n" - "instead of adding new inputs to compensate. (A future implementation could improve this.)\n" - "The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.\n" - "By default, the new fee will be calculated automatically using estimatefee.\n" - "The user can specify a confirmation target for estimatefee.\n" - "Alternatively, the user can specify totalFee, or use RPC settxfee to set a higher fee rate.\n" - "At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee\n" - "returned by getnetworkinfo) to enter the node's mempool.\n" - "\nArguments:\n" - "1. txid (string, required) The txid to be bumped\n" - "2. options (object, optional)\n" - " {\n" - " \"confTarget\" (numeric, optional) Confirmation target (in blocks)\n" - " \"totalFee\" (numeric, optional) Total fee (NOT feerate) to pay, in satoshis.\n" - " In rare cases, the actual fee paid might be slightly higher than the specified\n" - " totalFee if the tx change output has to be removed because it is too close to\n" - " the dust threshold.\n" - " \"replaceable\" (boolean, optional, default true) Whether the new transaction should still be\n" - " marked bip-125 replaceable. If true, the sequence numbers in the transaction will\n" - " be left unchanged from the original. If false, any input sequence numbers in the\n" - " original transaction that were less than 0xfffffffe will be increased to 0xfffffffe\n" - " so the new transaction will not be explicitly bip-125 replaceable (though it may\n" - " still be replaceable in practice, for example if it has unconfirmed ancestors which\n" - " are replaceable).\n" - " \"estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n" - " \"UNSET\"\n" - " \"ECONOMICAL\"\n" - " \"CONSERVATIVE\"\n" - " }\n" - "\nResult:\n" - "{\n" - " \"txid\": \"value\", (string) The id of the new transaction\n" - " \"origfee\": n, (numeric) Fee of the replaced transaction\n" - " \"fee\": n, (numeric) Fee of the new transaction\n" - " \"errors\": [ str... ] (json array of strings) Errors encountered during processing (may be empty)\n" - "}\n" - "\nExamples:\n" - "\nBump the fee, get the new transaction\'s txid\n" + - HelpExampleCli("bumpfee", "")); - } - - RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VOBJ}); - uint256 hash; - hash.SetHex(request.params[0].get_str()); - - // optional parameters - CAmount totalFee = 0; - CCoinControl coin_control; - coin_control.signalRbf = true; - if (!request.params[1].isNull()) { - UniValue options = request.params[1]; - RPCTypeCheckObj(options, - { - {"confTarget", UniValueType(UniValue::VNUM)}, - {"totalFee", UniValueType(UniValue::VNUM)}, - {"replaceable", UniValueType(UniValue::VBOOL)}, - {"estimate_mode", UniValueType(UniValue::VSTR)}, - }, - true, true); - - if (options.exists("confTarget") && options.exists("totalFee")) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "confTarget and totalFee options should not both be set. Please provide either a confirmation target for fee estimation or an explicit total fee for the transaction."); - } else if (options.exists("confTarget")) { // TODO: alias this to conf_target - coin_control.m_confirm_target = ParseConfirmTarget(options["confTarget"]); - } else if (options.exists("totalFee")) { - totalFee = options["totalFee"].get_int64(); - if (totalFee <= 0) { - throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid totalFee %s (must be greater than 0)", FormatMoney(totalFee))); - } - } - - if (options.exists("replaceable")) { - coin_control.signalRbf = options["replaceable"].get_bool(); - } - if (options.exists("estimate_mode")) { - if (!FeeModeFromString(options["estimate_mode"].get_str(), coin_control.m_fee_mode)) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter"); - } - } - } - - LOCK2(cs_main, pwallet->cs_wallet); - EnsureWalletIsUnlocked(pwallet); - - CFeeBumper feeBump(pwallet, hash, coin_control, totalFee); - BumpFeeResult res = feeBump.getResult(); - if (res != BumpFeeResult::OK) - { - switch(res) { - case BumpFeeResult::INVALID_ADDRESS_OR_KEY: - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, feeBump.getErrors()[0]); - break; - case BumpFeeResult::INVALID_REQUEST: - throw JSONRPCError(RPC_INVALID_REQUEST, feeBump.getErrors()[0]); - break; - case BumpFeeResult::INVALID_PARAMETER: - throw JSONRPCError(RPC_INVALID_PARAMETER, feeBump.getErrors()[0]); - break; - case BumpFeeResult::WALLET_ERROR: - throw JSONRPCError(RPC_WALLET_ERROR, feeBump.getErrors()[0]); - break; - default: - throw JSONRPCError(RPC_MISC_ERROR, feeBump.getErrors()[0]); - break; - } - } - - // sign bumped transaction - if (!feeBump.signTransaction(pwallet)) { - throw JSONRPCError(RPC_WALLET_ERROR, "Can't sign transaction."); - } - // commit the bumped transaction - if(!feeBump.commit(pwallet)) { - throw JSONRPCError(RPC_WALLET_ERROR, feeBump.getErrors()[0]); - } - UniValue result(UniValue::VOBJ); - result.push_back(Pair("txid", feeBump.getBumpedTxId().GetHex())); - result.push_back(Pair("origfee", ValueFromAmount(feeBump.getOldFee()))); - result.push_back(Pair("fee", ValueFromAmount(feeBump.getNewFee()))); - UniValue errors(UniValue::VARR); - for (const std::string& err: feeBump.getErrors()) - errors.push_back(err); - result.push_back(Pair("errors", errors)); - - return result; + throw std::runtime_error("bumpfee has been deprecated on the RVN Wallet."); + +// CWallet * const pwallet = GetWalletForJSONRPCRequest(request); +// +// if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) +// return NullUniValue; +// +// if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { +// throw std::runtime_error( +// "bumpfee \"txid\" ( options ) \n" +// "\nBumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B.\n" +// "An opt-in RBF transaction with the given txid must be in the wallet.\n" +// "The command will pay the additional fee by decreasing (or perhaps removing) its change output.\n" +// "If the change output is not big enough to cover the increased fee, the command will currently fail\n" +// "instead of adding new inputs to compensate. (A future implementation could improve this.)\n" +// "The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.\n" +// "By default, the new fee will be calculated automatically using estimatefee.\n" +// "The user can specify a confirmation target for estimatefee.\n" +// "Alternatively, the user can specify totalFee, or use RPC settxfee to set a higher fee rate.\n" +// "At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee\n" +// "returned by getnetworkinfo) to enter the node's mempool.\n" +// "\nArguments:\n" +// "1. txid (string, required) The txid to be bumped\n" +// "2. options (object, optional)\n" +// " {\n" +// " \"confTarget\" (numeric, optional) Confirmation target (in blocks)\n" +// " \"totalFee\" (numeric, optional) Total fee (NOT feerate) to pay, in satoshis.\n" +// " In rare cases, the actual fee paid might be slightly higher than the specified\n" +// " totalFee if the tx change output has to be removed because it is too close to\n" +// " the dust threshold.\n" +// " \"replaceable\" (boolean, optional, default true) Whether the new transaction should still be\n" +// " marked bip-125 replaceable. If true, the sequence numbers in the transaction will\n" +// " be left unchanged from the original. If false, any input sequence numbers in the\n" +// " original transaction that were less than 0xfffffffe will be increased to 0xfffffffe\n" +// " so the new transaction will not be explicitly bip-125 replaceable (though it may\n" +// " still be replaceable in practice, for example if it has unconfirmed ancestors which\n" +// " are replaceable).\n" +// " \"estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n" +// " \"UNSET\"\n" +// " \"ECONOMICAL\"\n" +// " \"CONSERVATIVE\"\n" +// " }\n" +// "\nResult:\n" +// "{\n" +// " \"txid\": \"value\", (string) The id of the new transaction\n" +// " \"origfee\": n, (numeric) Fee of the replaced transaction\n" +// " \"fee\": n, (numeric) Fee of the new transaction\n" +// " \"errors\": [ str... ] (json array of strings) Errors encountered during processing (may be empty)\n" +// "}\n" +// "\nExamples:\n" +// "\nBump the fee, get the new transaction\'s txid\n" + +// HelpExampleCli("bumpfee", "")); +// } +// +// RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VOBJ}); +// uint256 hash; +// hash.SetHex(request.params[0].get_str()); +// +// // optional parameters +// CAmount totalFee = 0; +// CCoinControl coin_control; +// coin_control.signalRbf = true; +// if (!request.params[1].isNull()) { +// UniValue options = request.params[1]; +// RPCTypeCheckObj(options, +// { +// {"confTarget", UniValueType(UniValue::VNUM)}, +// {"totalFee", UniValueType(UniValue::VNUM)}, +// {"replaceable", UniValueType(UniValue::VBOOL)}, +// {"estimate_mode", UniValueType(UniValue::VSTR)}, +// }, +// true, true); +// +// if (options.exists("confTarget") && options.exists("totalFee")) { +// throw JSONRPCError(RPC_INVALID_PARAMETER, "confTarget and totalFee options should not both be set. Please provide either a confirmation target for fee estimation or an explicit total fee for the transaction."); +// } else if (options.exists("confTarget")) { // TODO: alias this to conf_target +// coin_control.m_confirm_target = ParseConfirmTarget(options["confTarget"]); +// } else if (options.exists("totalFee")) { +// totalFee = options["totalFee"].get_int64(); +// if (totalFee <= 0) { +// throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid totalFee %s (must be greater than 0)", FormatMoney(totalFee))); +// } +// } +// +// if (options.exists("replaceable")) { +// coin_control.signalRbf = options["replaceable"].get_bool(); +// } +// if (options.exists("estimate_mode")) { +// if (!FeeModeFromString(options["estimate_mode"].get_str(), coin_control.m_fee_mode)) { +// throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter"); +// } +// } +// } +// +// LOCK2(cs_main, pwallet->cs_wallet); +// EnsureWalletIsUnlocked(pwallet); +// +// CFeeBumper feeBump(pwallet, hash, coin_control, totalFee); +// BumpFeeResult res = feeBump.getResult(); +// if (res != BumpFeeResult::OK) +// { +// switch(res) { +// case BumpFeeResult::INVALID_ADDRESS_OR_KEY: +// throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, feeBump.getErrors()[0]); +// break; +// case BumpFeeResult::INVALID_REQUEST: +// throw JSONRPCError(RPC_INVALID_REQUEST, feeBump.getErrors()[0]); +// break; +// case BumpFeeResult::INVALID_PARAMETER: +// throw JSONRPCError(RPC_INVALID_PARAMETER, feeBump.getErrors()[0]); +// break; +// case BumpFeeResult::WALLET_ERROR: +// throw JSONRPCError(RPC_WALLET_ERROR, feeBump.getErrors()[0]); +// break; +// default: +// throw JSONRPCError(RPC_MISC_ERROR, feeBump.getErrors()[0]); +// break; +// } +// } +// +// // sign bumped transaction +// if (!feeBump.signTransaction(pwallet)) { +// throw JSONRPCError(RPC_WALLET_ERROR, "Can't sign transaction."); +// } +// // commit the bumped transaction +// if(!feeBump.commit(pwallet)) { +// throw JSONRPCError(RPC_WALLET_ERROR, feeBump.getErrors()[0]); +// } +// UniValue result(UniValue::VOBJ); +// result.push_back(Pair("txid", feeBump.getBumpedTxId().GetHex())); +// result.push_back(Pair("origfee", ValueFromAmount(feeBump.getOldFee()))); +// result.push_back(Pair("fee", ValueFromAmount(feeBump.getNewFee()))); +// UniValue errors(UniValue::VARR); +// for (const std::string& err: feeBump.getErrors()) +// errors.push_back(err); +// result.push_back(Pair("errors", errors)); +// +// return result; } UniValue generate(const JSONRPCRequest& request) @@ -3372,8 +3374,8 @@ static const CRPCCommand commands[] = { "wallet", "lockunspent", &lockunspent, {"unlock","transactions"} }, { "wallet", "move", &movecmd, {"fromaccount","toaccount","amount","minconf","comment"} }, { "wallet", "sendfrom", &sendfrom, {"fromaccount","toaddress","amount","minconf","comment","comment_to"} }, - { "wallet", "sendmany", &sendmany, {"fromaccount","amounts","minconf","comment","subtractfeefrom","replaceable","conf_target","estimate_mode"} }, - { "wallet", "sendtoaddress", &sendtoaddress, {"address","amount","comment","comment_to","subtractfeefromamount","replaceable","conf_target","estimate_mode"} }, + { "wallet", "sendmany", &sendmany, {"fromaccount","amounts","minconf","comment","subtractfeefrom", "conf_target","estimate_mode"} }, + { "wallet", "sendtoaddress", &sendtoaddress, {"address","amount","comment","comment_to","subtractfeefromamount", "conf_target","estimate_mode"} }, { "wallet", "setaccount", &setaccount, {"address","account"} }, { "wallet", "settxfee", &settxfee, {"amount"} }, { "wallet", "signmessage", &signmessage, {"address","message"} }, diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 9a5862e6f3..dae010f69b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3451,7 +3451,8 @@ bool CWallet::CreateTransactionAll(const std::vector& vecSend, CWall // to avoid conflicting with other possible uses of nSequence, // and in the spirit of "smallest possible change from prior // behavior." - const uint32_t nSequence = coin_control.signalRbf ? MAX_BIP125_RBF_SEQUENCE : (CTxIn::SEQUENCE_FINAL - 1); +// const uint32_t nSequence = coin_control.signalRbf ? MAX_BIP125_RBF_SEQUENCE : (CTxIn::SEQUENCE_FINAL - 1); + const uint32_t nSequence = CTxIn::SEQUENCE_FINAL - 1; for (const auto& coin : setCoins) txNew.vin.push_back(CTxIn(coin.outpoint,CScript(), nSequence));