From 0de5edb7e2b6df2a590c149fcb4716aa805f11e6 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/feature_rbf.py | 1 + test/functional/mempool_accept.py | 2 +- test/functional/p2p_segwit.py | 6 +++--- test/functional/wallet_bumpfee.py | 5 +++-- test/functional/wallet_listtransactions.py | 3 +++ 9 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 59580fb34..9ff403282 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -1072,16 +1072,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 d202b671b..b22c71520 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -176,8 +176,9 @@ void SendCoinsDialog::setModel(WalletModel *_model) connect(ui->groupFee, static_cast(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::updateFeeSectionControls); connect(ui->groupFee, static_cast(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::coinControlUpdateLabels); connect(ui->customFee, &BitcoinAmountField::valueChanged, this, &SendCoinsDialog::coinControlUpdateLabels); - connect(ui->optInRBF, &QCheckBox::stateChanged, this, &SendCoinsDialog::updateSmartFeeLabel); - connect(ui->optInRBF, &QCheckBox::stateChanged, this, &SendCoinsDialog::coinControlUpdateLabels); + // Litecoin: Disable RBF + // connect(ui->optInRBF, &QCheckBox::stateChanged, this, &SendCoinsDialog::updateSmartFeeLabel); + // connect(ui->optInRBF, &QCheckBox::stateChanged, this, &SendCoinsDialog::coinControlUpdateLabels); CAmount requiredFee = model->wallet().getRequiredFee(1000); ui->customFee->SetMinValue(requiredFee); if (ui->customFee->value() < requiredFee) { @@ -188,7 +189,8 @@ void SendCoinsDialog::setModel(WalletModel *_model) updateSmartFeeLabel(); // set default rbf checkbox state - ui->optInRBF->setCheckState(Qt::Checked); + // Litecoin: Disable RBF + // ui->optInRBF->setCheckState(Qt::Checked); if (model->wallet().privateKeysDisabled()) { ui->sendButton->setText(tr("Cr&eate Unsigned")); @@ -334,6 +336,7 @@ bool SendCoinsDialog::PrepareSendText(QString& question_string, QString& informa question_string.append("
"); // append RBF message according to transaction's signalling + /* Litecoin: Disable RBF question_string.append(""); if (ui->optInRBF->isChecked()) { question_string.append(tr("You can increase the fee later (signals Replace-By-Fee, BIP-125).")); @@ -341,6 +344,7 @@ bool SendCoinsDialog::PrepareSendText(QString& question_string, QString& informa question_string.append(tr("Not signalling Replace-By-Fee, BIP-125.")); } question_string.append(""); + */ } // add total amount in all subdivision units @@ -741,7 +745,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(); // Include watch-only for wallets without private key ctrl.fAllowWatchOnly = model->wallet().privateKeysDisabled(); } diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index d6d2d0e3d..dfee83f2a 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -64,10 +64,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; @@ -93,6 +95,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"); @@ -117,6 +120,7 @@ void BumpFee(TransactionView& view, const uint256& txid, bool expectDisabled, st action->trigger(); QVERIFY(text.indexOf(QString::fromStdString(expectError)) != -1); } +*/ //! Simple qt wallet tests. // @@ -191,10 +195,11 @@ void TestGUI(interfaces::Node& node) 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 c2bcf4b02..943d50b71 100644 --- a/src/validation.h +++ b/src/validation.h @@ -75,7 +75,7 @@ static const bool DEFAULT_CHECKPOINTS_ENABLED = true; static const bool DEFAULT_TXINDEX = false; static const char* const DEFAULT_BLOCKFILTERINDEX = "0"; /** Default for -persistmempool */ -static const bool DEFAULT_PERSIST_MEMPOOL = true; +static const bool DEFAULT_PERSIST_MEMPOOL = false; /** Default for using fee filter */ static const bool DEFAULT_FEEFILTER = true; /** Default for -stopatheight */ diff --git a/test/functional/feature_rbf.py b/test/functional/feature_rbf.py index 1b531ad51..3934614c8 100755 --- a/test/functional/feature_rbf.py +++ b/test/functional/feature_rbf.py @@ -74,6 +74,7 @@ class ReplaceByFeeTest(BitcoinTestFramework): "-limitancestorsize=101", "-limitdescendantcount=200", "-limitdescendantsize=101", + "-mempoolreplacement=1", ], ] self.supports_cli = False diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py index fc4c77566..3157fe79a 100755 --- a/test/functional/mempool_accept.py +++ b/test/functional/mempool_accept.py @@ -41,7 +41,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 self.extra_args = [[ - '-txindex','-permitbaremultisig=0', + '-txindex', '-mempoolreplacement=1', '-permitbaremultisig=0', ]] * self.num_nodes self.supports_cli = False diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py index 4825c0f28..11965cb29 100755 --- a/test/functional/p2p_segwit.py +++ b/test/functional/p2p_segwit.py @@ -220,9 +220,9 @@ class SegWitTest(BitcoinTestFramework): self.num_nodes = 3 # This test tests SegWit both pre and post-activation, so use the normal BIP9 activation. self.extra_args = [ - ["-acceptnonstdtxn=1", "-segwitheight={}".format(SEGWIT_HEIGHT), "-whitelist=noban@127.0.0.1"], - ["-acceptnonstdtxn=0", "-segwitheight={}".format(SEGWIT_HEIGHT)], - ["-acceptnonstdtxn=1", "-segwitheight=-1"], + ["-acceptnonstdtxn=1", "-segwitheight={}".format(SEGWIT_HEIGHT), "-whitelist=noban@127.0.0.1", "-mempoolreplacement=1"], + ["-acceptnonstdtxn=0", "-segwitheight={}".format(SEGWIT_HEIGHT), "-mempoolreplacement=1"], + ["-acceptnonstdtxn=1", "-segwitheight=-1"], "-mempoolreplacement=1", ] self.supports_cli = False diff --git a/test/functional/wallet_bumpfee.py b/test/functional/wallet_bumpfee.py index c8c1f2e37..5426750fc 100755 --- a/test/functional/wallet_bumpfee.py +++ b/test/functional/wallet_bumpfee.py @@ -18,7 +18,7 @@ import io 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, @@ -56,6 +56,7 @@ class BumpFeeTest(BitcoinTestFramework): self.sync_all() def run_test(self): + # Encrypt wallet for test_locked_wallet_fails test self.nodes[1].encryptwallet(WALLET_PASSPHRASE) self.nodes[1].walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT) @@ -567,7 +568,7 @@ def submit_block_with_tx(node, tx): tip = node.getbestblockhash() height = node.getblockcount() + 1 block_time = node.getblockheader(tip)["mediantime"] + 1 - block = create_block(int(tip, 16), create_coinbase(height), block_time) + block = create_block(int(tip, 16), create_coinbase(height), block_time, version=0x20000000) block.vtx.append(ctx) block.rehash() block.hashMerkleRoot = block.calc_merkle_root() diff --git a/test/functional/wallet_listtransactions.py b/test/functional/wallet_listtransactions.py index 3e9820843..0376a6e2d 100755 --- a/test/functional/wallet_listtransactions.py +++ b/test/functional/wallet_listtransactions.py @@ -23,6 +23,9 @@ def tx_from_hex(hexstring): class ListTransactionsTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 2 + self.extra_args = [[ + "-mempoolreplacement=1", + ] for i in range(self.num_nodes)] def skip_test_if_missing_module(self): self.skip_if_no_wallet()