Merge pull request #4731 from vijaydasmp/bp2001

Merge bitcoin#17251,17250,17279,17299,17306,15756,17203,17719
This commit is contained in:
PastaPastaPasta 2022-04-20 14:08:24 -05:00 committed by GitHub
commit c2ecc0c721
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 55 additions and 46 deletions

View File

@ -149,7 +149,7 @@ bool CChainParams::HasLLMQ(Consensus::LLMQType llmqType) const
class CMainParams : public CChainParams {
public:
CMainParams() {
strNetworkID = "main";
strNetworkID = CBaseChainParams::MAIN;
consensus.nSubsidyHalvingInterval = 210240; // Note: actual number of blocks per calendar year with DGW v3 is ~200700 (for example 449750 - 249050)
consensus.nMasternodePaymentsStartBlock = 100000; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
consensus.nMasternodePaymentsIncreaseBlock = 158000; // actual historical value
@ -373,7 +373,7 @@ public:
class CTestNetParams : public CChainParams {
public:
CTestNetParams() {
strNetworkID = "test";
strNetworkID = CBaseChainParams::TESTNET;
consensus.nSubsidyHalvingInterval = 210240;
consensus.nMasternodePaymentsStartBlock = 4010; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
consensus.nMasternodePaymentsIncreaseBlock = 4030;
@ -570,7 +570,7 @@ public:
class CDevNetParams : public CChainParams {
public:
explicit CDevNetParams(const ArgsManager& args) {
strNetworkID = "devnet";
strNetworkID = CBaseChainParams::DEVNET;
consensus.nSubsidyHalvingInterval = 210240;
consensus.nMasternodePaymentsStartBlock = 4010; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
consensus.nMasternodePaymentsIncreaseBlock = 4030;
@ -829,7 +829,7 @@ public:
class CRegTestParams : public CChainParams {
public:
explicit CRegTestParams(const ArgsManager& args) {
strNetworkID = "regtest";
strNetworkID = CBaseChainParams::REGTEST;
consensus.nSubsidyHalvingInterval = 150;
consensus.nMasternodePaymentsStartBlock = 240;
consensus.nMasternodePaymentsIncreaseBlock = 350;

View File

@ -458,7 +458,7 @@ public:
return MakeHandler(
::uiInterface.NotifyHeaderTip_connect([fn](bool initial_download, const CBlockIndex* block) {
fn(initial_download, block->nHeight, block->GetBlockTime(), block->GetBlockHash().ToString(),
GuessVerificationProgress(Params().TxData(), block));
/* verification progress is unused when a header was received */ 0);
}));
}
std::unique_ptr<Handler> handleNotifyMasternodeListChanged(NotifyMasternodeListChangedFn fn) override

View File

@ -1849,7 +1849,7 @@ size_t CConnman::SocketRecvData(CNode *pnode)
{
// socket closed gracefully
if (!pnode->fDisconnect) {
LogPrint(BCLog::NET, "socket closed\n");
LogPrint(BCLog::NET, "socket closed for peer=%d\n", pnode->GetId());
}
LOCK(cs_vNodes);
pnode->fOtherSideDisconnected = true; // avoid lingering
@ -1861,8 +1861,9 @@ size_t CConnman::SocketRecvData(CNode *pnode)
int nErr = WSAGetLastError();
if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
{
if (!pnode->fDisconnect)
LogPrintf("socket recv error %s\n", NetworkErrorString(nErr));
if (!pnode->fDisconnect){
LogPrint(BCLog::NET, "socket recv error for peer=%d: %s\n", pnode->GetId(), NetworkErrorString(nErr));
}
LOCK(cs_vNodes);
pnode->fOtherSideDisconnected = true; // avoid lingering
pnode->CloseSocketDisconnect(this);

View File

@ -527,12 +527,6 @@ void BitcoinGUI::createActions()
});
}
#endif // ENABLE_WALLET
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I), this), &QShortcut::activated, this, &BitcoinGUI::showInfo);
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this), &QShortcut::activated, this, &BitcoinGUI::showConsole);
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G), this), &QShortcut::activated, this, &BitcoinGUI::showGraph);
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P), this), &QShortcut::activated, this, &BitcoinGUI::showPeers);
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_R), this), &QShortcut::activated, this, &BitcoinGUI::showRepair);
}
void BitcoinGUI::createMenuBar()
@ -620,6 +614,7 @@ void BitcoinGUI::createMenuBar()
window_menu->addSeparator();
for (RPCConsole::TabTypes tab_type : rpcConsole->tabs()) {
QAction* tab_action = window_menu->addAction(rpcConsole->tabTitle(tab_type));
tab_action->setShortcut(rpcConsole->tabShortcut(tab_type));
connect(tab_action, &QAction::triggered, [this, tab_type] {
rpcConsole->setTabFocus(tab_type);
showDebugWindow();
@ -1057,31 +1052,31 @@ void BitcoinGUI::showDebugWindow()
void BitcoinGUI::showInfo()
{
rpcConsole->setTabFocus(RPCConsole::TAB_INFO);
rpcConsole->setTabFocus(RPCConsole::TabTypes::INFO);
showDebugWindow();
}
void BitcoinGUI::showConsole()
{
rpcConsole->setTabFocus(RPCConsole::TAB_CONSOLE);
rpcConsole->setTabFocus(RPCConsole::TabTypes::CONSOLE);
showDebugWindow();
}
void BitcoinGUI::showGraph()
{
rpcConsole->setTabFocus(RPCConsole::TAB_GRAPH);
rpcConsole->setTabFocus(RPCConsole::TabTypes::GRAPH);
showDebugWindow();
}
void BitcoinGUI::showPeers()
{
rpcConsole->setTabFocus(RPCConsole::TAB_PEERS);
rpcConsole->setTabFocus(RPCConsole::TabTypes::PEERS);
showDebugWindow();
}
void BitcoinGUI::showRepair()
{
rpcConsole->setTabFocus(RPCConsole::TAB_REPAIR);
rpcConsole->setTabFocus(RPCConsole::TabTypes::REPAIR);
showDebugWindow();
}

View File

@ -529,7 +529,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, QWidget* parent, Qt::WindowFlags
pageButtons->addButton(ui->btnRepair, pageButtons->buttons().size());
connect(pageButtons, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &RPCConsole::showPage);
showPage(TAB_INFO);
showPage(int(TabTypes::INFO));
reloadThemedWidgets();
}
@ -1429,10 +1429,23 @@ void RPCConsole::showOrHideBanTableIfRequired()
void RPCConsole::setTabFocus(enum TabTypes tabType)
{
showPage(tabType);
showPage(int(tabType));
}
QString RPCConsole::tabTitle(TabTypes tab_type) const
{
return pageButtons->button(tab_type)->text();
return pageButtons->button(int(tab_type))->text();
}
QKeySequence RPCConsole::tabShortcut(TabTypes tab_type) const
{
switch (tab_type) {
case TabTypes::INFO: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I);
case TabTypes::CONSOLE: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C);
case TabTypes::GRAPH: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G);
case TabTypes::PEERS: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P);
case TabTypes::REPAIR: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_R);
} // no default case, so the compiler can warn about missing cases
assert(false);
}

View File

@ -59,17 +59,18 @@ public:
CMD_ERROR
};
enum TabTypes {
TAB_INFO = 0,
TAB_CONSOLE = 1,
TAB_GRAPH = 2,
TAB_PEERS = 3,
TAB_REPAIR = 4
enum class TabTypes {
INFO,
CONSOLE,
GRAPH,
PEERS,
REPAIR
};
std::vector<TabTypes> tabs() const { return {TAB_INFO, TAB_CONSOLE, TAB_GRAPH, TAB_PEERS, TAB_REPAIR}; }
std::vector<TabTypes> tabs() const { return {TabTypes::INFO, TabTypes::CONSOLE, TabTypes::GRAPH, TabTypes::PEERS, TabTypes::REPAIR}; }
QString tabTitle(TabTypes tab_type) const;
QKeySequence tabShortcut(TabTypes tab_type) const;
protected:
virtual bool eventFilter(QObject* obj, QEvent *event) override;

View File

@ -346,7 +346,9 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
BOOST_CHECK_EQUAL(nDustThreshold, 546);
// dust:
t.vout[0].nValue = nDustThreshold - 1;
reason.clear();
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
BOOST_CHECK_EQUAL(reason, "dust");
// not dust:
t.vout[0].nValue = nDustThreshold;
BOOST_CHECK(IsStandardTx(CTransaction(t), reason));
@ -381,14 +383,18 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
minRelayTxFee = CFeeRate(3702);
// dust:
t.vout[0].nValue = 546 - 1;
reason.clear();
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
BOOST_CHECK_EQUAL(reason, "dust");
// not dust:
t.vout[0].nValue = 546;
BOOST_CHECK(IsStandardTx(CTransaction(t), reason));
minRelayTxFee = CFeeRate(DUST_RELAY_TX_FEE);
t.vout[0].scriptPubKey = CScript() << OP_1;
reason.clear();
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
BOOST_CHECK_EQUAL(reason, "scriptpubkey");
// MAX_OP_RETURN_RELAY-byte TX_NULL_DATA (standard)
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3804678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38");
@ -398,7 +404,9 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
// MAX_OP_RETURN_RELAY+1-byte TX_NULL_DATA (non-standard)
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3804678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3800");
BOOST_CHECK_EQUAL(MAX_OP_RETURN_RELAY + 1, t.vout[0].scriptPubKey.size());
reason.clear();
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
BOOST_CHECK_EQUAL(reason, "scriptpubkey");
// Data payload can be encoded in any way...
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("");
@ -413,7 +421,9 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
// ...so long as it only contains PUSHDATA's
t.vout[0].scriptPubKey = CScript() << OP_RETURN << OP_RETURN;
reason.clear();
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
BOOST_CHECK_EQUAL(reason, "scriptpubkey");
// TX_NULL_DATA w/o PUSHDATA
t.vout.resize(1);
@ -424,15 +434,21 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
t.vout.resize(2);
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38");
t.vout[1].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38");
reason.clear();
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
BOOST_CHECK_EQUAL(reason, "multi-op-return");
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38");
t.vout[1].scriptPubKey = CScript() << OP_RETURN;
reason.clear();
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
BOOST_CHECK_EQUAL(reason, "multi-op-return");
t.vout[0].scriptPubKey = CScript() << OP_RETURN;
t.vout[1].scriptPubKey = CScript() << OP_RETURN;
reason.clear();
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
BOOST_CHECK_EQUAL(reason, "multi-op-return");
}
BOOST_AUTO_TEST_SUITE_END()

View File

@ -4284,21 +4284,6 @@ bool CWallet::DelAddressBook(const CTxDestination& address)
return WalletBatch(*database).EraseName(EncodeDestination(address));
}
const std::string& CWallet::GetLabelName(const CScript& scriptPubKey) const
{
CTxDestination address;
if (ExtractDestination(scriptPubKey, address) && !scriptPubKey.IsUnspendable()) {
auto mi = mapAddressBook.find(address);
if (mi != mapAddressBook.end()) {
return mi->second.name;
}
}
// A scriptPubKey that doesn't have an entry in the address book is
// associated with the default label ("").
const static std::string DEFAULT_LABEL_NAME;
return DEFAULT_LABEL_NAME;
}
/**
* Mark old keypool keys as used,
* and generate all new keys

View File

@ -1177,8 +1177,6 @@ public:
bool DelAddressBook(const CTxDestination& address);
const std::string& GetLabelName(const CScript& scriptPubKey) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
void GetScriptForMining(std::shared_ptr<CReserveScript> &script);
unsigned int GetKeyPoolSize() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)