mirror of
https://github.com/dashpay/dash.git
synced 2024-12-23 19:12:47 +01:00
Merge #6300: backport: Merge bitcoin#23642, 22794, 23316, 24365, gui#517, 24219, 23253, 24449, 22543
3931608858
Merge bitcoin/bitcoin#22543: test: Use MiniWallet in mempool_limit.py (merge-script)f147373a32
Merge bitcoin/bitcoin#24449: fuzz: FuzzedFileProvider::write should not return negative value (MarcoFalke)2a2a2693d0
Merge bitcoin/bitcoin#23253: bitcoin-tx: Reject non-integral and out of range int strings (W. J. van der Laan)11eeae2ab9
Merge bitcoin/bitcoin#24219: Fix implicit-integer-sign-change in bloom (MarcoFalke)f16265dd50
Merge bitcoin-core/gui#517: refactor, qt: Use std::chrono for parameters of QTimer methods (Hennadii Stepanov)b212ca0515
Merge bitcoin/bitcoin#24365: wallet: Don't generate keys for wallets with private keys disabled during upgradewallet (laanwj)66e77f7879
Merge bitcoin/bitcoin#23316: test: make the node param explicit in init_wallet() (MarcoFalke)995cae46af
Merge bitcoin/bitcoin#22794: test: Verify if wallet is compiled in rpc_invalid_address_message.py test (MarcoFalke)61a0140362
Merge bitcoin/bitcoin#23642: refactor: Call type-solver earlier in decodescript (MarcoFalke) Pull request description: Bitcoin Backports ACKs for top commit: UdjinM6: utACK3931608858
PastaPastaPasta: utACK3931608858
Tree-SHA512: 38f384776002e8014b2510aeaf1f4655fea0531011eb326eb2ab546d9e7193ad9e5c4b570d9831f88bb696e06ded04259a21ddb750d7ffedfedebdbb9a951379
This commit is contained in:
commit
5bf0409eba
@ -220,6 +220,16 @@ static void MutateTxLocktime(CMutableTransaction& tx, const std::string& cmdVal)
|
||||
tx.nLockTime = (unsigned int) newLocktime;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static T TrimAndParse(const std::string& int_str, const std::string& err)
|
||||
{
|
||||
const auto parsed{ToIntegral<T>(TrimString(int_str))};
|
||||
if (!parsed.has_value()) {
|
||||
throw std::runtime_error(err + " '" + int_str + "'");
|
||||
}
|
||||
return parsed.value();
|
||||
}
|
||||
|
||||
static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInput)
|
||||
{
|
||||
std::vector<std::string> vStrInputParts = SplitString(strInput, ':');
|
||||
@ -245,8 +255,9 @@ static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInpu
|
||||
|
||||
// extract the optional sequence number
|
||||
uint32_t nSequenceIn = CTxIn::SEQUENCE_FINAL;
|
||||
if (vStrInputParts.size() > 2)
|
||||
nSequenceIn = std::stoul(vStrInputParts[2]);
|
||||
if (vStrInputParts.size() > 2) {
|
||||
nSequenceIn = TrimAndParse<uint32_t>(vStrInputParts.at(2), "invalid TX sequence id");
|
||||
}
|
||||
|
||||
// append to transaction input list
|
||||
CTxIn txin(txid, vout, CScript(), nSequenceIn);
|
||||
@ -324,10 +335,10 @@ static void MutateTxAddOutMultiSig(CMutableTransaction& tx, const std::string& s
|
||||
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
|
||||
|
||||
// Extract REQUIRED
|
||||
uint32_t required = stoul(vStrInputParts[1]);
|
||||
const uint32_t required{TrimAndParse<uint32_t>(vStrInputParts.at(1), "invalid multisig required number")};
|
||||
|
||||
// Extract NUMKEYS
|
||||
uint32_t numkeys = stoul(vStrInputParts[2]);
|
||||
const uint32_t numkeys{TrimAndParse<uint32_t>(vStrInputParts.at(2), "invalid multisig total number")};
|
||||
|
||||
// Validate there are the correct number of pubkeys
|
||||
if (vStrInputParts.size() < numkeys + 3)
|
||||
|
@ -314,8 +314,8 @@ void CRollingBloomFilter::insert(Span<const unsigned char> vKey)
|
||||
/* FastMod works with the upper bits of h, so it is safe to ignore that the lower bits of h are already used for bit. */
|
||||
uint32_t pos = FastRange32(h, data.size());
|
||||
/* The lowest bit of pos is ignored, and set to zero for the first bit, and to one for the second. */
|
||||
data[pos & ~1] = (data[pos & ~1] & ~(((uint64_t)1) << bit)) | ((uint64_t)(nGeneration & 1)) << bit;
|
||||
data[pos | 1] = (data[pos | 1] & ~(((uint64_t)1) << bit)) | ((uint64_t)(nGeneration >> 1)) << bit;
|
||||
data[pos & ~1U] = (data[pos & ~1U] & ~(uint64_t{1} << bit)) | (uint64_t(nGeneration & 1)) << bit;
|
||||
data[pos | 1] = (data[pos | 1] & ~(uint64_t{1} << bit)) | (uint64_t(nGeneration >> 1)) << bit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,7 +326,7 @@ bool CRollingBloomFilter::contains(Span<const unsigned char> vKey) const
|
||||
int bit = h & 0x3F;
|
||||
uint32_t pos = FastRange32(h, data.size());
|
||||
/* If the relevant bit is not set in either data[pos & ~1] or data[pos | 1], the filter does not contain vKey */
|
||||
if (!(((data[pos & ~1] | data[pos | 1]) >> bit) & 1)) {
|
||||
if (!(((data[pos & ~1U] | data[pos | 1]) >> bit) & 1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
#include <boost/signals2/connection.hpp>
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
||||
#include <QApplication>
|
||||
@ -397,10 +398,10 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
|
||||
connect(paymentServer, &PaymentServer::message, [this](const QString& title, const QString& message, unsigned int style) {
|
||||
window->message(title, message, style);
|
||||
});
|
||||
QTimer::singleShot(100, paymentServer, &PaymentServer::uiReady);
|
||||
QTimer::singleShot(100ms, paymentServer, &PaymentServer::uiReady);
|
||||
}
|
||||
#endif
|
||||
pollShutdownTimer->start(200);
|
||||
pollShutdownTimer->start(SHUTDOWN_POLLING_DELAY);
|
||||
} else {
|
||||
Q_EMIT splashFinished(); // Make sure splash screen doesn't stick around during shutdown
|
||||
quit(); // Exit first main loop invocation
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <netbase.h>
|
||||
#include <util/system.h>
|
||||
#include <util/threadnames.h>
|
||||
#include <util/time.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <stdint.h>
|
||||
@ -323,7 +324,7 @@ static void BlockTipChanged(ClientModel* clientmodel, SynchronizationState sync_
|
||||
const bool throttle = (sync_state != SynchronizationState::POST_INIT && !fHeader) || sync_state == SynchronizationState::INIT_REINDEX;
|
||||
const int64_t now = throttle ? GetTimeMillis() : 0;
|
||||
int64_t& nLastUpdateNotification = fHeader ? nLastHeaderTipUpdateNotification : nLastBlockTipUpdateNotification;
|
||||
if (throttle && now < nLastUpdateNotification + MODEL_UPDATE_DELAY) {
|
||||
if (throttle && now < nLastUpdateNotification + count_milliseconds(MODEL_UPDATE_DELAY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,16 @@
|
||||
#ifndef BITCOIN_QT_GUICONSTANTS_H
|
||||
#define BITCOIN_QT_GUICONSTANTS_H
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
|
||||
/* Milliseconds between model updates */
|
||||
static const int MODEL_UPDATE_DELAY = 250;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
/* A delay between model updates */
|
||||
static constexpr auto MODEL_UPDATE_DELAY{250ms};
|
||||
|
||||
/* A delay between shutdown pollings */
|
||||
static constexpr auto SHUTDOWN_POLLING_DELAY{200ms};
|
||||
|
||||
/* AskPassphraseDialog -- Maximum passphrase length */
|
||||
static const int MAX_PASSPHRASE_SIZE = 1024;
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include <util/underlying.h>
|
||||
|
||||
#include <QButtonGroup>
|
||||
#include <chrono>
|
||||
|
||||
#include <QDataWidgetMapper>
|
||||
#include <QDir>
|
||||
#include <QIntValidator>
|
||||
@ -457,7 +459,7 @@ void OptionsDialog::showRestartWarning(bool fPersistent)
|
||||
ui->statusLabel->setText(tr("This change would require a client restart."));
|
||||
// clear non-persistent status label after 10 seconds
|
||||
// Todo: should perhaps be a class attribute, if we extend the use of statusLabel
|
||||
QTimer::singleShot(10000, this, &OptionsDialog::clearStatusLabel);
|
||||
QTimer::singleShot(10s, this, &OptionsDialog::clearStatusLabel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,10 +24,11 @@
|
||||
#include <node/interface_ui.h>
|
||||
#include <policy/fees.h>
|
||||
#include <txmempool.h>
|
||||
#include <validation.h>
|
||||
#include <wallet/coincontrol.h>
|
||||
#include <wallet/fees.h>
|
||||
#include <wallet/wallet.h>
|
||||
#include <validation.h>
|
||||
#include <chrono>
|
||||
|
||||
#include <array>
|
||||
#include <fstream>
|
||||
@ -1080,7 +1081,7 @@ SendConfirmationDialog::SendConfirmationDialog(const QString& title, const QStri
|
||||
int SendConfirmationDialog::exec()
|
||||
{
|
||||
updateYesButton();
|
||||
countDownTimer.start(1000);
|
||||
countDownTimer.start(1s);
|
||||
return QMessageBox::exec();
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <wallet/wallet.h>
|
||||
#include <walletinitinterface.h>
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTimer>
|
||||
#include <QMessageBox>
|
||||
@ -39,7 +41,7 @@ void EditAddressAndSubmit(
|
||||
dialog->findChild<QLineEdit*>("labelEdit")->setText(label);
|
||||
dialog->findChild<QValidatedLineEdit*>("addressEdit")->setText(address);
|
||||
|
||||
ConfirmMessage(&warning_text, 5);
|
||||
ConfirmMessage(&warning_text, 5ms);
|
||||
dialog->accept();
|
||||
QCOMPARE(warning_text, expected_msg);
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
@ -9,7 +11,7 @@
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
|
||||
void ConfirmMessage(QString* text, int msec)
|
||||
void ConfirmMessage(QString* text, std::chrono::milliseconds msec)
|
||||
{
|
||||
QTimer::singleShot(msec, [text]() {
|
||||
for (QWidget* widget : QApplication::topLevelWidgets()) {
|
||||
|
@ -5,7 +5,11 @@
|
||||
#ifndef BITCOIN_QT_TEST_UTIL_H
|
||||
#define BITCOIN_QT_TEST_UTIL_H
|
||||
|
||||
#include <QString>
|
||||
#include <chrono>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QString;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
/**
|
||||
* Press "Ok" button in message box dialog.
|
||||
@ -13,6 +17,6 @@
|
||||
* @param text - Optionally store dialog text.
|
||||
* @param msec - Number of milliseconds to pause before triggering the callback.
|
||||
*/
|
||||
void ConfirmMessage(QString* text = nullptr, int msec = 0);
|
||||
void ConfirmMessage(QString* text, std::chrono::milliseconds msec);
|
||||
|
||||
#endif // BITCOIN_QT_TEST_UTIL_H
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <qt/recentrequeststablemodel.h>
|
||||
#include <qt/receiverequestdialog.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
||||
#include <QAbstractButton>
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <optional>
|
||||
|
||||
#include <QCalendarWidget>
|
||||
#include <chrono>
|
||||
#include <QComboBox>
|
||||
#include <QDateTimeEdit>
|
||||
#include <QDesktopServices>
|
||||
@ -114,8 +115,8 @@ TransactionView::TransactionView(QWidget* parent) :
|
||||
amountWidget->setObjectName("amountWidget");
|
||||
hlayout->addWidget(amountWidget);
|
||||
|
||||
// Delay before filtering transactions in ms
|
||||
static const int input_filter_delay = 200;
|
||||
// Delay before filtering transactions
|
||||
static constexpr auto input_filter_delay{200ms};
|
||||
|
||||
QTimer* amount_typing_delay = new QTimer(this);
|
||||
amount_typing_delay->setSingleShot(true);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <wallet/wallet.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
@ -271,12 +272,12 @@ void CreateWalletActivity::createWallet()
|
||||
flags |= WALLET_FLAG_DESCRIPTORS;
|
||||
}
|
||||
|
||||
QTimer::singleShot(500, worker(), [this, name, flags] {
|
||||
QTimer::singleShot(500ms, worker(), [this, name, flags] {
|
||||
std::unique_ptr<interfaces::Wallet> wallet = node().walletLoader().createWallet(name, m_passphrase, flags, m_error_message, m_warning_message);
|
||||
|
||||
if (wallet) m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(wallet));
|
||||
|
||||
QTimer::singleShot(500, this, &CreateWalletActivity::finish);
|
||||
QTimer::singleShot(500ms, this, &CreateWalletActivity::finish);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -874,7 +874,8 @@ static RPCHelpMan decoderawtransaction()
|
||||
|
||||
static RPCHelpMan decodescript()
|
||||
{
|
||||
return RPCHelpMan{"decodescript",
|
||||
return RPCHelpMan{
|
||||
"decodescript",
|
||||
"\nDecode a hex-encoded script.\n",
|
||||
{
|
||||
{"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded script"},
|
||||
@ -891,7 +892,7 @@ static RPCHelpMan decodescript()
|
||||
{RPCResult::Type::STR, "address", "Dash address"},
|
||||
}},
|
||||
{RPCResult::Type::STR, "p2sh", "address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH)"},
|
||||
}
|
||||
},
|
||||
},
|
||||
RPCExamples{
|
||||
HelpExampleCli("decodescript", "\"hexstring\"")
|
||||
@ -911,11 +912,10 @@ static RPCHelpMan decodescript()
|
||||
}
|
||||
ScriptPubKeyToUniv(script, r, /* fIncludeHex */ false);
|
||||
|
||||
UniValue type;
|
||||
std::vector<std::vector<unsigned char>> solutions_data;
|
||||
const TxoutType which_type{Solver(script, solutions_data)};
|
||||
|
||||
type = find_value(r, "type");
|
||||
|
||||
if (type.isStr() && type.get_str() != "scripthash") {
|
||||
if (which_type != TxoutType::SCRIPTHASH) {
|
||||
// P2SH cannot be wrapped in a P2SH. If this script is already a P2SH,
|
||||
// don't return the address for a P2SH of the P2SH.
|
||||
r.pushKV("p2sh", EncodeDestination(ScriptHash(script)));
|
||||
|
@ -461,7 +461,7 @@ ssize_t FuzzedFileProvider::write(void* cookie, const char* buf, size_t size)
|
||||
SetFuzzedErrNo(fuzzed_file->m_fuzzed_data_provider);
|
||||
const ssize_t n = fuzzed_file->m_fuzzed_data_provider.ConsumeIntegralInRange<ssize_t>(0, size);
|
||||
if (AdditionOverflow(fuzzed_file->m_offset, (int64_t)n)) {
|
||||
return fuzzed_file->m_fuzzed_data_provider.ConsumeBool() ? 0 : -1;
|
||||
return 0;
|
||||
}
|
||||
fuzzed_file->m_offset += n;
|
||||
return n;
|
||||
|
@ -6,8 +6,11 @@
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
from test_framework.blocktools import COINBASE_MATURITY
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal, assert_greater_than, assert_raises_rpc_error, create_confirmed_utxos, create_lots_of_big_transactions, gen_return_txouts
|
||||
from test_framework.util import assert_equal, assert_greater_than, assert_raises_rpc_error, gen_return_txouts
|
||||
from test_framework.wallet import MiniWallet
|
||||
|
||||
|
||||
class MempoolLimitTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
@ -20,55 +23,59 @@ class MempoolLimitTest(BitcoinTestFramework):
|
||||
]]
|
||||
self.supports_cli = False
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
def send_large_txs(self, node, miniwallet, txouts, fee_rate, tx_batch_size):
|
||||
for _ in range(tx_batch_size):
|
||||
tx = miniwallet.create_self_transfer(from_node=node, fee_rate=fee_rate)['tx']
|
||||
for txout in txouts:
|
||||
tx.vout.append(txout)
|
||||
miniwallet.sendrawtransaction(from_node=node, tx_hex=tx.serialize().hex())
|
||||
|
||||
def run_test(self):
|
||||
txouts = gen_return_txouts()
|
||||
relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||
node=self.nodes[0]
|
||||
miniwallet = MiniWallet(node)
|
||||
relayfee = node.getnetworkinfo()['relayfee']
|
||||
|
||||
self.log.info('Check that mempoolminfee is minrelytxfee')
|
||||
assert_equal(self.nodes[0].getmempoolinfo()['minrelaytxfee'], Decimal('0.00001000'))
|
||||
assert_equal(self.nodes[0].getmempoolinfo()['mempoolminfee'], Decimal('0.00001000'))
|
||||
self.log.info('Check that mempoolminfee is minrelaytxfee')
|
||||
assert_equal(node.getmempoolinfo()['minrelaytxfee'], Decimal('0.00001000'))
|
||||
assert_equal(node.getmempoolinfo()['mempoolminfee'], Decimal('0.00001000'))
|
||||
|
||||
txids = []
|
||||
utxos = create_confirmed_utxos(self, relayfee, self.nodes[0], 491)
|
||||
tx_batch_size = 25
|
||||
num_of_batches = 3
|
||||
# Generate UTXOs to flood the mempool
|
||||
# 1 to create a tx initially that will be evicted from the mempool later
|
||||
# 3 batches of multiple transactions with a fee rate much higher than the previous UTXO
|
||||
# And 1 more to verify that this tx does not get added to the mempool with a fee rate less than the mempoolminfee
|
||||
self.generate(miniwallet, 1 + (num_of_batches * tx_batch_size) + 1)
|
||||
|
||||
# Mine 99 blocks so that the UTXOs are allowed to be spent
|
||||
self.generate(node, COINBASE_MATURITY - 1)
|
||||
|
||||
self.log.info('Create a mempool tx that will be evicted')
|
||||
us0 = utxos.pop()
|
||||
inputs = [{ "txid" : us0["txid"], "vout" : us0["vout"]}]
|
||||
outputs = {self.nodes[0].getnewaddress() : 0.0001}
|
||||
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
self.nodes[0].settxfee(relayfee) # specifically fund this tx with low fee
|
||||
txF = self.nodes[0].fundrawtransaction(tx)
|
||||
self.nodes[0].settxfee(0) # return to automatic fee selection
|
||||
txFS = self.nodes[0].signrawtransactionwithwallet(txF['hex'])
|
||||
txid = self.nodes[0].sendrawtransaction(txFS['hex'])
|
||||
tx_to_be_evicted_id = miniwallet.send_self_transfer(from_node=node, fee_rate=relayfee)["txid"]
|
||||
|
||||
relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||
base_fee = relayfee*100
|
||||
for i in range (3):
|
||||
txids.append([])
|
||||
txids[i] = create_lots_of_big_transactions(self.nodes[0], txouts, utxos[30*i:30*i+30], 30, (i+1)*base_fee)
|
||||
# Increase the tx fee rate massively to give the subsequent transactions a higher priority in the mempool
|
||||
base_fee = relayfee * 1000
|
||||
|
||||
self.log.info("Fill up the mempool with txs with higher fee rate")
|
||||
for batch_of_txid in range(num_of_batches):
|
||||
fee_rate=(batch_of_txid + 1) * base_fee
|
||||
self.send_large_txs(node, miniwallet, txouts, fee_rate, tx_batch_size)
|
||||
|
||||
self.log.info('The tx should be evicted by now')
|
||||
assert txid not in self.nodes[0].getrawmempool()
|
||||
txdata = self.nodes[0].gettransaction(txid)
|
||||
assert txdata['confirmations'] == 0 #confirmation should still be 0
|
||||
# The number of transactions created should be greater than the ones present in the mempool
|
||||
assert_greater_than(tx_batch_size * num_of_batches, len(node.getrawmempool()))
|
||||
# Initial tx created should not be present in the mempool anymore as it had a lower fee rate
|
||||
assert tx_to_be_evicted_id not in node.getrawmempool()
|
||||
|
||||
self.log.info('Check that mempoolminfee is larger than minrelytxfee')
|
||||
assert_equal(self.nodes[0].getmempoolinfo()['minrelaytxfee'], Decimal('0.00001000'))
|
||||
assert_greater_than(self.nodes[0].getmempoolinfo()['mempoolminfee'], Decimal('0.00001000'))
|
||||
self.log.info('Check that mempoolminfee is larger than minrelaytxfee')
|
||||
assert_equal(node.getmempoolinfo()['minrelaytxfee'], Decimal('0.00001000'))
|
||||
assert_greater_than(node.getmempoolinfo()['mempoolminfee'], Decimal('0.00001000'))
|
||||
|
||||
# Deliberately try to create a tx with a fee less than the minimum mempool fee to assert that it does not get added to the mempool
|
||||
self.log.info('Create a mempool tx that will not pass mempoolminfee')
|
||||
us0 = utxos.pop()
|
||||
inputs = [{ "txid" : us0["txid"], "vout" : us0["vout"]}]
|
||||
outputs = {self.nodes[0].getnewaddress() : 0.0001}
|
||||
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
# specifically fund this tx with a fee < mempoolminfee, >= than minrelaytxfee
|
||||
txF = self.nodes[0].fundrawtransaction(tx, {'feeRate': relayfee})
|
||||
txFS = self.nodes[0].signrawtransactionwithwallet(txF['hex'])
|
||||
assert_raises_rpc_error(-26, "mempool min fee not met", self.nodes[0].sendrawtransaction, txFS['hex'])
|
||||
assert_raises_rpc_error(-26, "mempool min fee not met", miniwallet.send_self_transfer, from_node=node, fee_rate=relayfee, mempool_valid=False)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
MempoolLimitTest().main()
|
||||
|
@ -22,9 +22,6 @@ class InvalidAddressErrorMessageTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def test_validateaddress(self):
|
||||
node = self.nodes[0]
|
||||
|
||||
@ -50,6 +47,9 @@ class InvalidAddressErrorMessageTest(BitcoinTestFramework):
|
||||
|
||||
def run_test(self):
|
||||
self.test_validateaddress()
|
||||
|
||||
if self.is_wallet_compiled():
|
||||
self.init_wallet(node=0)
|
||||
self.test_getaddressinfo()
|
||||
|
||||
|
||||
|
@ -473,12 +473,12 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
|
||||
def import_deterministic_coinbase_privkeys(self):
|
||||
for i in range(len(self.nodes)):
|
||||
self.init_wallet(i)
|
||||
self.init_wallet(node=i)
|
||||
|
||||
def init_wallet(self, i):
|
||||
wallet_name = self.default_wallet_name if self.wallet_names is None else self.wallet_names[i] if i < len(self.wallet_names) else False
|
||||
def init_wallet(self, *, node):
|
||||
wallet_name = self.default_wallet_name if self.wallet_names is None else self.wallet_names[node] if node < len(self.wallet_names) else False
|
||||
if wallet_name is not False:
|
||||
n = self.nodes[i]
|
||||
n = self.nodes[node]
|
||||
if wallet_name is not None:
|
||||
n.createwallet(wallet_name=wallet_name, descriptors=self.options.descriptors, load_on_startup=True)
|
||||
n.importprivkey(privkey=n.get_deterministic_priv_key().key, label='coinbase', rescan=True)
|
||||
|
@ -135,9 +135,9 @@ class WalletBackupTest(BitcoinTestFramework):
|
||||
assert os.path.exists(wallet_file)
|
||||
|
||||
def init_three(self):
|
||||
self.init_wallet(0)
|
||||
self.init_wallet(1)
|
||||
self.init_wallet(2)
|
||||
self.init_wallet(node=0)
|
||||
self.init_wallet(node=1)
|
||||
self.init_wallet(node=2)
|
||||
|
||||
def run_test(self):
|
||||
self.log.info("Generating initial blockchain")
|
||||
|
@ -23,7 +23,7 @@ class ListDescriptorsTest(BitcoinTestFramework):
|
||||
self.skip_if_no_sqlite()
|
||||
|
||||
# do not create any wallet by default
|
||||
def init_wallet(self, i):
|
||||
def init_wallet(self, *, node):
|
||||
return
|
||||
|
||||
def run_test(self):
|
||||
|
@ -239,5 +239,16 @@ class UpgradeWalletTest(BitcoinTestFramework):
|
||||
desc_wallet = self.nodes[0].get_wallet_rpc("desc_upgrade")
|
||||
self.test_upgradewallet(desc_wallet, previous_version=120200, expected_version=120200)
|
||||
|
||||
self.log.info("Checking that descriptor wallets without privkeys do nothing, successfully")
|
||||
self.nodes[0].createwallet(wallet_name="desc_upgrade_nopriv", descriptors=True, disable_private_keys=True)
|
||||
desc_wallet = self.nodes[0].get_wallet_rpc("desc_upgrade_nopriv")
|
||||
self.test_upgradewallet(desc_wallet, previous_version=120200, expected_version=120200)
|
||||
|
||||
if self.is_bdb_compiled():
|
||||
self.log.info("Upgrading a wallet with private keys disabled")
|
||||
self.nodes[0].createwallet(wallet_name="privkeys_disabled_upgrade", disable_private_keys=True, descriptors=False)
|
||||
disabled_wallet = self.nodes[0].get_wallet_rpc("privkeys_disabled_upgrade")
|
||||
self.test_upgradewallet(disabled_wallet, previous_version=120200, expected_version=120200)
|
||||
|
||||
if __name__ == '__main__':
|
||||
UpgradeWalletTest().main()
|
||||
|
@ -48,7 +48,6 @@ implicit-integer-sign-change:*/include/c++/
|
||||
implicit-integer-sign-change:*/new_allocator.h
|
||||
implicit-integer-sign-change:addrman.h
|
||||
implicit-integer-sign-change:bech32.cpp
|
||||
implicit-integer-sign-change:common/bloom.cpp
|
||||
implicit-integer-sign-change:chain.cpp
|
||||
implicit-integer-sign-change:chain.h
|
||||
implicit-integer-sign-change:compat/stdin.cpp
|
||||
|
@ -425,6 +425,30 @@
|
||||
"output_cmp": "txcreatedata2.json",
|
||||
"description": "Creates a new transaction with one input, one address output and one data (zero value) output (output in json)"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args":
|
||||
["-create",
|
||||
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:11aa"],
|
||||
"return_code": 1,
|
||||
"error_txt": "error: invalid TX sequence id '11aa'",
|
||||
"description": "Try to parse a sequence number outside the allowed range"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args":
|
||||
["-create",
|
||||
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:-1"],
|
||||
"return_code": 1,
|
||||
"error_txt": "error: invalid TX sequence id '-1'",
|
||||
"description": "Try to parse a sequence number outside the allowed range"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args":
|
||||
["-create",
|
||||
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:4294967296"],
|
||||
"return_code": 1,
|
||||
"error_txt": "error: invalid TX sequence id '4294967296'",
|
||||
"description": "Try to parse a sequence number outside the allowed range"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args":
|
||||
["-create",
|
||||
@ -433,6 +457,14 @@
|
||||
"output_cmp": "txcreatedata_seq0.hex",
|
||||
"description": "Creates a new transaction with one input with sequence number and one address output"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args":
|
||||
["-create",
|
||||
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0: 4294967293 ",
|
||||
"outaddr=0.18:XijDvbYpPmznwgpWD3DkdYNfGmRP2KoVSk"],
|
||||
"output_cmp": "txcreatedata_seq0.hex",
|
||||
"description": "Creates a new transaction with one input with sequence number (+whitespace) and one address output"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args":
|
||||
["-json",
|
||||
@ -457,6 +489,18 @@
|
||||
"output_cmp": "txcreatedata_seq1.json",
|
||||
"description": "Adds a new input with sequence number to a transaction (output in json)"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args": ["-create", "outmultisig=1:-2:3:02a5:021:02df", "nversion=1"],
|
||||
"return_code": 1,
|
||||
"error_txt": "error: invalid multisig required number '-2'",
|
||||
"description": "Try to parse a multisig number outside the allowed range"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args": ["-create", "outmultisig=1:2:3a:02a5:021:02df", "nversion=1"],
|
||||
"return_code": 1,
|
||||
"error_txt": "error: invalid multisig total number '3a'",
|
||||
"description": "Try to parse a multisig number outside the allowed range"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485", "nversion=1"],
|
||||
"output_cmp": "txcreatemultisig1.hex",
|
||||
@ -465,7 +509,7 @@
|
||||
{ "exec": "./dash-tx",
|
||||
"args": ["-json", "-create", "outmultisig=1: 2: 3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485", "nversion=1"],
|
||||
"output_cmp": "txcreatemultisig1.json",
|
||||
"description": "Creates a new transaction with a single 2-of-3 multisig output (output in json)"
|
||||
"description": "Creates a new transaction with a single 2-of-3 multisig output (with whitespace, output in json)"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:S", "nversion=1"],
|
||||
|
Loading…
Reference in New Issue
Block a user