From 0af99bc29d6101afdadd89f8127d04e3e12e5c17 Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Wed, 3 Oct 2018 22:01:50 -0700 Subject: [PATCH] Litecoin: Disable RBF --- src/qt/forms/sendcoinsdialog.ui | 10 ---------- src/qt/sendcoinsdialog.cpp | 13 +++++++++---- src/qt/test/wallettests.cpp | 13 +++++++++---- src/validation.h | 2 +- test/functional/mempool_accept.py | 1 + test/functional/p2p_segwit.py | 2 +- test/functional/wallet_balance.py | 1 + test/functional/wallet_bumpfee.py | 4 +++- test/functional/wallet_listtransactions.py | 3 ++- 9 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 8855d3879..795ada94e 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -1107,16 +1107,6 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p - - - - Enable Replace-By-Fee - - - With Replace-By-Fee (BIP-125) you can increase a transaction's fee after it is sent. Without this, a higher fee may be recommended to compensate for increased transaction delay risk. - - - diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 1159d7b4c..3e0890ff4 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -173,15 +173,17 @@ 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())); + // Litecoin: Disable RBF + // connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(updateSmartFeeLabel())); + // connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); ui->customFee->setSingleStep(model->wallet().getRequiredFee(1000)); updateFeeSectionControls(); updateMinFeeLabel(); updateSmartFeeLabel(); // set default rbf checkbox state - ui->optInRBF->setCheckState(Qt::Checked); + // Litecoin: Disable RBF + // ui->optInRBF->setCheckState(Qt::Checked); // set the smartfee-sliders default value (wallets default conf.target or last stored value) QSettings settings; @@ -335,6 +337,7 @@ void SendCoinsDialog::on_sendButton_clicked() questionString.append("
"); // append RBF message according to transaction's signalling + /* Litecoin: Disable RBF questionString.append(""); if (ui->optInRBF->isChecked()) { questionString.append(tr("You can increase the fee later (signals Replace-By-Fee, BIP-125).")); @@ -342,6 +345,7 @@ void SendCoinsDialog::on_sendButton_clicked() questionString.append(tr("Not signalling Replace-By-Fee, BIP-125.")); } questionString.append(""); + */ } // add total amount in all subdivision units @@ -682,7 +686,8 @@ 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.m_signal_bip125_rbf = ui->optInRBF->isChecked(); + // Litecoin: Disable RBF GUI + // ctrl.m_signal_bip125_rbf = ui->optInRBF->isChecked(); } void SendCoinsDialog::updateSmartFeeLabel() diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index c6889ee5e..38b6a5a8f 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -60,10 +60,12 @@ uint256 SendCoins(CWallet& wallet, SendCoinsDialog& sendCoinsDialog, const CTxDe SendCoinsEntry* entry = qobject_cast(entries->itemAt(0)->widget()); entry->findChild("payTo")->setText(QString::fromStdString(EncodeDestination(address))); entry->findChild("payAmount")->setValue(amount); + /* Litecon: Disabled RBF UI sendCoinsDialog.findChild("frameFee") ->findChild("frameFeeSelection") ->findChild("optInRBF") ->setCheckState(rbf ? Qt::Checked : Qt::Unchecked); + */ uint256 txid; boost::signals2::scoped_connection c(wallet.NotifyTransactionChanged.connect([&txid](CWallet*, const uint256& hash, ChangeType status) { if (status == CT_NEW) txid = hash; @@ -88,6 +90,7 @@ QModelIndex FindTx(const QAbstractItemModel& model, const uint256& txid) } //! Invoke bumpfee on txid and check results. +/* Litecoin: Disable RBF void BumpFee(TransactionView& view, const uint256& txid, bool expectDisabled, std::string expectError, bool cancel) { QTableView* table = view.findChild("transactionView"); @@ -112,6 +115,7 @@ void BumpFee(TransactionView& view, const uint256& txid, bool expectDisabled, st action->trigger(); QVERIFY(text.indexOf(QString::fromStdString(expectError)) != -1); } +*/ //! Simple qt wallet tests. // @@ -171,10 +175,11 @@ void TestGUI() QVERIFY(FindTx(*transactionTableModel, txid2).isValid()); // Call bumpfee. Test disabled, canceled, enabled, then failing cases. - BumpFee(transactionView, txid1, true /* expect disabled */, "not BIP 125 replaceable" /* expected error */, false /* cancel */); - BumpFee(transactionView, txid2, false /* expect disabled */, {} /* expected error */, true /* cancel */); - BumpFee(transactionView, txid2, false /* expect disabled */, {} /* expected error */, false /* cancel */); - BumpFee(transactionView, txid2, true /* expect disabled */, "already bumped" /* expected error */, false /* cancel */); + // Litecoin: Disable BumpFee tests + // BumpFee(transactionView, txid1, true /* expect disabled */, "not BIP 125 replaceable" /* expected error */, false /* cancel */); + // BumpFee(transactionView, txid2, false /* expect disabled */, {} /* expected error */, true /* cancel */); + // BumpFee(transactionView, txid2, false /* expect disabled */, {} /* expected error */, false /* cancel */); + // BumpFee(transactionView, txid2, true /* expect disabled */, "already bumped" /* expected error */, false /* cancel */); // Check current balance on OverviewPage OverviewPage overviewPage(platformStyle.get()); diff --git a/src/validation.h b/src/validation.h index fe1d09aea..638eb0f7a 100644 --- a/src/validation.h +++ b/src/validation.h @@ -121,7 +121,7 @@ static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100; /** Default for -persistmempool */ static const bool DEFAULT_PERSIST_MEMPOOL = true; /** Default for -mempoolreplacement */ -static const bool DEFAULT_ENABLE_REPLACEMENT = true; +static const bool DEFAULT_ENABLE_REPLACEMENT = false; /** Default for using fee filter */ static const bool DEFAULT_FEEFILTER = true; diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py index bae8d99d1..aab632dab 100755 --- a/test/functional/mempool_accept.py +++ b/test/functional/mempool_accept.py @@ -36,6 +36,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework): self.num_nodes = 1 self.extra_args = [[ '-txindex', + '-mempoolreplacement=1', '-reindex', # Need reindex for txindex '-acceptnonstdtxn=0', # Try to mimic main-net ]] * self.num_nodes diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py index 963d09f5b..9da503a13 100755 --- a/test/functional/p2p_segwit.py +++ b/test/functional/p2p_segwit.py @@ -196,7 +196,7 @@ class SegWitTest(BitcoinTestFramework): self.setup_clean_chain = True self.num_nodes = 3 # This test tests SegWit both pre and post-activation, so use the normal BIP9 activation. - self.extra_args = [["-whitelist=127.0.0.1", "-vbparams=segwit:0:999999999999"], ["-whitelist=127.0.0.1", "-acceptnonstdtxn=0", "-vbparams=segwit:0:999999999999"], ["-whitelist=127.0.0.1", "-vbparams=segwit:0:0"]] + self.extra_args = [["-whitelist=127.0.0.1", "-vbparams=segwit:0:999999999999", "-mempoolreplacement=1"], ["-whitelist=127.0.0.1", "-acceptnonstdtxn=0", "-vbparams=segwit:0:999999999999", "-mempoolreplacement=1"], ["-whitelist=127.0.0.1", "-vbparams=segwit:0:0", "-mempoolreplacement=1"]] def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/wallet_balance.py b/test/functional/wallet_balance.py index 05c97e034..cd5c6cb01 100755 --- a/test/functional/wallet_balance.py +++ b/test/functional/wallet_balance.py @@ -41,6 +41,7 @@ class WalletTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 2 self.setup_clean_chain = True + self.extra_args = [["-mempoolreplacement=1"], ["-mempoolreplacement=1"]] def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/wallet_bumpfee.py b/test/functional/wallet_bumpfee.py index b9fe6c66c..14932000d 100755 --- a/test/functional/wallet_bumpfee.py +++ b/test/functional/wallet_bumpfee.py @@ -18,7 +18,7 @@ from decimal import Decimal from test_framework.blocktools import add_witness_commitment, create_block, create_coinbase, send_to_witness from test_framework.messages import BIP125_SEQUENCE_NUMBER, CTransaction -from test_framework.test_framework import BitcoinTestFramework +from test_framework.test_framework import BitcoinTestFramework, SkipTest from test_framework.util import assert_equal, assert_greater_than, assert_raises_rpc_error, bytes_to_hex_str, connect_nodes_bi, hex_str_to_bytes, sync_mempools import io @@ -40,6 +40,8 @@ class BumpFeeTest(BitcoinTestFramework): self.skip_if_no_wallet() def run_test(self): + raise SkipTest("Litecoin doesn't support RBF.") + # Encrypt wallet for test_locked_wallet_fails test self.nodes[1].node_encrypt_wallet(WALLET_PASSPHRASE) self.start_node(1) diff --git a/test/functional/wallet_listtransactions.py b/test/functional/wallet_listtransactions.py index 00a6b9c39..db4dbad18 100755 --- a/test/functional/wallet_listtransactions.py +++ b/test/functional/wallet_listtransactions.py @@ -102,7 +102,8 @@ class ListTransactionsTest(BitcoinTestFramework): {"category": "receive", "amount": Decimal("0.1")}, {"txid": txid, "label": "watchonly"}) - self.run_rbf_opt_in_test() + # Litecoin has RBF disabled + # self.run_rbf_opt_in_test() # Check that the opt-in-rbf flag works properly, for sent and received # transactions.