Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
335b53b
Merge #9622: [rpc] listsinceblock should include lost transactions wh…
laanwj Jul 24, 2017
52c0557
Fix unlocked_until in getwalletinfo rpc
floriansengel Mar 1, 2019
213c01d
Remove nonnull warning when calling secp256k1_schnorr_sign with NULL …
floriansengel Mar 27, 2019
72ca222
[Part 2 of 5] Add a CChainState class to clarify internal interfaces
TheBlueMatt Mar 27, 2019
b43bcd2
[secp256k1] add schnorr verify jni binding
Mar 28, 2019
786177c
Merge #10858: [RPC] Add "warnings" field to getblockchaininfo and uni…
laanwj Sep 28, 2017
c309939
remove unused fnoncriticalerrors variable from cwalletdb::findwallettx
PierreRochard Dec 17, 2017
3ae078c
[Part 3 of 5] Add a CChainState class to clarify internal interfaces
TheBlueMatt Mar 30, 2019
842f968
Fix comment about s in schnorr sigs
floriansengel Mar 26, 2019
601ef7d
Lint everything
deadalnix Mar 30, 2019
cbc0d5b
Backport remaining changes from Core PR 10742
jasonbcox Apr 2, 2019
6bfa21c
Merge #10275: [rpc] Allow fetching tx directly from specified block i…
laanwj Apr 2, 2019
e6f9787
Use static_cast instead of C-style casts for non-fundamental types
Apr 2, 2019
1535160
Add schnorr sign benchmark
floriansengel Mar 27, 2019
b0b7f96
Add schnorr verify benchmark
floriansengel Mar 27, 2019
2b6875c
Update wallet_listsinceblock.py to use signrawtransactionwithwallet rpc
Fabcien Apr 2, 2019
62ba082
[Target v0.19] Deprecate and add test for signrawtransaction
Fabcien Feb 11, 2019
af4f8fe
Document method for reviewers to verify chainTxData
jnewbery Apr 4, 2019
86b2afb
qa: Improve getchaintxstats functional test
promag Apr 4, 2019
5046a63
Fix Windows build errors introduced in D2765
practicalswift Feb 12, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@ Bitcoin-ABC 19.x backports:
- Added parameter `include_removed` to `listsinceblock` for better tracking of transactions during a reorg. See `bitcoin-cli help listsinceblock` for more details.
- `listsinceblock` will now throw an error if an unknown `blockhash` argument value is passed, instead of returning a list of all wallet transactions since
the genesis block.
- Various minor fixes to RPC parameter validation
- Minor wallet performance improvements
- `errors` in getmininginfo rpc commmand has been deprecated. Use `warnings` now instead.
- Added optional `blockhash` parameter to `getrawtransaction` to narrowly
search for a transaction within a given block. New returned field
`in_active_chain` will indicate if that block is part of the active chain.
- `signrawtransaction` RPC is now deprecated. The new RPCs
`signrawtransactionwithkey` and `signrawtransactionwithwallet` should
be used instead.
2 changes: 1 addition & 1 deletion src/addrman.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CAddrInfo : public CAddress {

template <typename Stream, typename Operation>
inline void SerializationOp(Stream &s, Operation ser_action) {
READWRITE(*(CAddress *)this);
READWRITE(*static_cast<CAddress *>(this));
READWRITE(source);
READWRITE(nLastSuccess);
READWRITE(nAttempts);
Expand Down
6 changes: 3 additions & 3 deletions src/core_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ CScript ParseScript(const std::string &s) {
continue;
}

const char *name = GetOpName((opcodetype)op);
const char *name = GetOpName(static_cast<opcodetype>(op));
if (strcmp(name, "OP_UNKNOWN") == 0) {
continue;
}

std::string strName(name);
mapOpNames[strName] = (opcodetype)op;
mapOpNames[strName] = static_cast<opcodetype>(op);
// Convenience: OP_ADD and just ADD are both recognized:
strName.replace(strName.find("OP_"),3,"");
mapOpNames[strName] = (opcodetype)op;
mapOpNames[strName] = static_cast<opcodetype>(op);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/httpserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ struct event_base *EventBase() {

static void httpevent_callback_fn(evutil_socket_t, short, void *data) {
// Static handler: simply call inner handler
HTTPEvent *self = ((HTTPEvent *)data);
HTTPEvent *self = static_cast<HTTPEvent *>(data);
self->handler();
if (self->deleteWhenTriggered) delete self;
}
Expand Down
3 changes: 2 additions & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2109,7 +2109,8 @@ void CConnman::OpenNetworkConnection(const CAddress &addrConnect,
return;
}
if (!pszDest) {
if (IsLocal(addrConnect) || FindNode((CNetAddr)addrConnect) ||
if (IsLocal(addrConnect) ||
FindNode(static_cast<CNetAddr>(addrConnect)) ||
IsBanned(addrConnect) || FindNode(addrConnect.ToStringIPPort())) {
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/netaddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,8 @@ unsigned short CService::GetPort() const {
}

bool operator==(const CService &a, const CService &b) {
return (CNetAddr)a == (CNetAddr)b && a.port == b.port;
return static_cast<CNetAddr>(a) == static_cast<CNetAddr>(b) &&
a.port == b.port;
}

bool operator<(const CService &a, const CService &b) {
Expand Down
4 changes: 2 additions & 2 deletions src/primitives/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ class CBlock : public CBlockHeader {

CBlock(const CBlockHeader &header) {
SetNull();
*((CBlockHeader *)this) = header;
*(static_cast<CBlockHeader *>(this)) = header;
}

ADD_SERIALIZE_METHODS;

template <typename Stream, typename Operation>
inline void SerializationOp(Stream &s, Operation ser_action) {
READWRITE(*(CBlockHeader *)this);
READWRITE(*static_cast<CBlockHeader *>(this));
READWRITE(vtx);
}

Expand Down
4 changes: 2 additions & 2 deletions src/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ class CAddress : public CService {
READWRITE(nTime);
uint64_t nServicesInt = nServices;
READWRITE(nServicesInt);
nServices = (ServiceFlags)nServicesInt;
READWRITE(*(CService *)this);
nServices = static_cast<ServiceFlags>(nServicesInt);
READWRITE(*static_cast<CService *>(this));
}

// TODO: make private (improves encapsulation)
Expand Down
9 changes: 5 additions & 4 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ void BitcoinGUI::createTrayIconMenu() {
#else
// Note: On Mac, the dock icon is used to provide the tray's functionality.
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
dockIconHandler->setMainWindow((QMainWindow *)this);
dockIconHandler->setMainWindow(static_cast<QMainWindow *>(this));
trayIconMenu = dockIconHandler->dockMenu();
#endif

Expand Down Expand Up @@ -996,14 +996,15 @@ void BitcoinGUI::message(const QString &title, const QString &message,
buttons = QMessageBox::Ok;

showNormalIfMinimized();
QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message,
buttons, this);
QMessageBox mBox(static_cast<QMessageBox::Icon>(nMBoxIcon), strTitle,
message, buttons, this);
int r = mBox.exec();
if (ret != nullptr) {
*ret = r == QMessageBox::Ok;
}
} else
notificator->notify((Notificator::Class)nNotifyIcon, strTitle, message);
notificator->notify(static_cast<Notificator::Class>(nNotifyIcon),
strTitle, message);
}

void BitcoinGUI::changeEvent(QEvent *e) {
Expand Down
12 changes: 7 additions & 5 deletions src/qt/coincontroldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle,
ui->radioTreeMode->click();
if (settings.contains("nCoinControlSortColumn") &&
settings.contains("nCoinControlSortOrder"))
sortView(
settings.value("nCoinControlSortColumn").toInt(),
((Qt::SortOrder)settings.value("nCoinControlSortOrder").toInt()));
sortView(settings.value("nCoinControlSortColumn").toInt(),
(static_cast<Qt::SortOrder>(
settings.value("nCoinControlSortOrder").toInt())));
}

CoinControlDialog::~CoinControlDialog() {
Expand Down Expand Up @@ -473,7 +473,8 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog *dialog) {
nPayAmount += amount;

if (amount > Amount::zero()) {
CTxOut txout(Amount(amount), (CScript)std::vector<uint8_t>(24, 0));
CTxOut txout(amount,
static_cast<CScript>(std::vector<uint8_t>(24, 0)));
txDummy.vout.push_back(txout);
if (txout.IsDust(dustRelayFee)) {
fDust = true;
Expand Down Expand Up @@ -566,7 +567,8 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog *dialog) {
// Never create dust outputs; if we would, just add the dust to the
// fee.
if (nChange > Amount::zero() && nChange < MIN_CHANGE) {
CTxOut txout(nChange, (CScript)std::vector<uint8_t>(24, 0));
CTxOut txout(nChange,
static_cast<CScript>(std::vector<uint8_t>(24, 0)));
if (txout.IsDust(dustRelayFee)) {
// dust-change will be raised until no dust
if (CoinControlDialog::fSubtractFeeFromAmount) {
Expand Down
2 changes: 1 addition & 1 deletion src/qt/coincontroltreewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void CoinControlTreeWidget::keyPressEvent(QKeyEvent *event) {
{
event->ignore();
CoinControlDialog *coinControlDialog =
(CoinControlDialog *)this->parentWidget();
static_cast<CoinControlDialog *>(this->parentWidget());
coinControlDialog->done(QDialog::Accepted);
} else {
this->QTreeWidget::keyPressEvent(event);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/sendcoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ void SendCoinsDialog::on_sendButton_clicked() {
SEND_CONFIRM_DELAY, this);
confirmationDialog.exec();
QMessageBox::StandardButton retval =
(QMessageBox::StandardButton)confirmationDialog.result();
static_cast<QMessageBox::StandardButton>(confirmationDialog.result());

if (retval != QMessageBox::Yes) {
fNewRecipientAllowed = true;
Expand Down
2 changes: 1 addition & 1 deletion src/qt/splashscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle)
float fontFactor = 1.0;
float devicePixelRatio = 1.0;
#if QT_VERSION > 0x050100
devicePixelRatio = ((QGuiApplication*)QCoreApplication::instance())->devicePixelRatio();
devicePixelRatio = static_cast<QGuiApplication *>(QCoreApplication::instance())->devicePixelRatio();
#endif

// define text to place
Expand Down
4 changes: 2 additions & 2 deletions src/qt/transactionview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ void TransactionView::chooseWatchonly(int idx) {
}

transactionProxyModel->setWatchOnlyFilter(
(TransactionFilterProxy::WatchOnlyFilter)watchOnlyWidget->itemData(idx)
.toInt());
static_cast<TransactionFilterProxy::WatchOnlyFilter>(
watchOnlyWidget->itemData(idx).toInt()));
}

void TransactionView::changedPrefix(const QString &prefix) {
Expand Down
64 changes: 31 additions & 33 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "util.h"
#include "utilstrencodings.h"
#include "validation.h"
#include "warnings.h"

#include <boost/thread/thread.hpp> // boost::thread::interrupt

Expand Down Expand Up @@ -1280,6 +1281,7 @@ UniValue getblockchaininfo(const Config &config,

obj.pushKV("pruneheight", block->nHeight);
}
obj.pushKV("warnings", GetWarnings("statusbar"));
return obj;
}

Expand Down Expand Up @@ -1705,20 +1707,22 @@ UniValue getchaintxstats(const Config &config, const JSONRPCRequest &request) {
"ends the window.\n"
"\nResult:\n"
"{\n"
" \"time\": xxxxx, (numeric) The timestamp for the "
"final block in the window in UNIX format.\n"
" \"txcount\": xxxxx, (numeric) The total number of "
"transactions in the chain up to that point.\n"
" \"window_block_count\": xxxxx, (numeric) Size of the window in "
"number of blocks.\n"
" \"window_tx_count\": xxxxx, (numeric) The number of "
"transactions in the window. Only returned if "
" \"time\": xxxxx, (numeric) The "
"timestamp for the final block in the window in UNIX format.\n"
" \"txcount\": xxxxx, (numeric) The total "
"number of transactions in the chain up to that point.\n"
" \"window_final_block_hash\": \"...\", (string) The hash of "
"the final block in the window.\n"
" \"window_block_count\": xxxxx, (numeric) Size of "
"the window in number of blocks.\n"
" \"window_tx_count\": xxxxx, (numeric) The number "
"of transactions in the window. Only returned if "
"\"window_block_count\" is > 0.\n"
" \"window_interval\": xxxxx, (numeric) The elapsed time in "
"the window in seconds. Only returned if \"window_block_count\" is "
"> 0.\n"
" \"txrate\": x.xx, (numeric) The average rate of "
"transactions per second in the window. Only returned if "
" \"window_interval\": xxxxx, (numeric) The elapsed "
"time in the window in seconds. Only returned if "
"\"window_block_count\" is > 0.\n"
" \"txrate\": x.xx, (numeric) The average "
"rate of transactions per second in the window. Only returned if "
"\"window_interval\" is > 0.\n"
"}\n"
"\nExamples:\n" +
Expand All @@ -1732,27 +1736,20 @@ UniValue getchaintxstats(const Config &config, const JSONRPCRequest &request) {
int blockcount = 30 * 24 * 60 * 60 /
config.GetChainParams().GetConsensus().nPowTargetSpacing;

bool havehash = !request.params[1].isNull();
uint256 hash;
if (havehash) {
hash = uint256S(request.params[1].get_str());
}

{
if (request.params[1].isNull()) {
LOCK(cs_main);
if (havehash) {
auto it = mapBlockIndex.find(hash);
if (it == mapBlockIndex.end()) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY,
"Block not found");
}
pindex = it->second;
if (!chainActive.Contains(pindex)) {
throw JSONRPCError(RPC_INVALID_PARAMETER,
"Block is not in main chain");
}
} else {
pindex = chainActive.Tip();
pindex = chainActive.Tip();
} else {
uint256 hash = uint256S(request.params[1].get_str());
LOCK(cs_main);
auto it = mapBlockIndex.find(hash);
if (it == mapBlockIndex.end()) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
}
pindex = it->second;
if (!chainActive.Contains(pindex)) {
throw JSONRPCError(RPC_INVALID_PARAMETER,
"Block is not in main chain");
}
}

Expand Down Expand Up @@ -1780,6 +1777,7 @@ UniValue getchaintxstats(const Config &config, const JSONRPCRequest &request) {
UniValue ret(UniValue::VOBJ);
ret.pushKV("time", int64_t(pindex->nTime));
ret.pushKV("txcount", int64_t(pindex->nChainTx));
ret.pushKV("window_final_block_hash", pindex->GetBlockHash().GetHex());
ret.pushKV("window_block_count", blockcount);
if (blockcount > 0) {
ret.pushKV("window_tx_count", nTxDiff);
Expand Down
12 changes: 10 additions & 2 deletions src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,16 @@ static UniValue getmininginfo(const Config &config,
" \"currentblocktx\": nnn, (numeric) The last block "
"transaction\n"
" \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n"
" \"errors\": \"...\" (string) Current errors\n"
" \"networkhashps\": nnn, (numeric) The network hashes per "
"second\n"
" \"pooledtx\": n (numeric) The size of the mempool\n"
" \"chain\": \"xxxx\", (string) current network name as "
"defined in BIP70 (main, test, regtest)\n"
" \"warnings\": \"...\" (string) any network and "
"blockchain warnings\n"
" \"errors\": \"...\" (string) DEPRECATED. Same as "
"warnings. Only shown when bitcoind is started with "
"-deprecatedrpc=getmininginfo\n"
"}\n"
"\nExamples:\n" +
HelpExampleCli("getmininginfo", "") +
Expand All @@ -256,10 +260,14 @@ static UniValue getmininginfo(const Config &config,
obj.pushKV("blockprioritypercentage",
uint8_t(gArgs.GetArg("-blockprioritypercentage",
DEFAULT_BLOCK_PRIORITY_PERCENTAGE)));
obj.pushKV("errors", GetWarnings("statusbar"));
obj.pushKV("networkhashps", getnetworkhashps(config, request));
obj.pushKV("pooledtx", uint64_t(g_mempool.size()));
obj.pushKV("chain", config.GetChainParams().NetworkIDString());
if (IsDeprecatedRPCEnabled(gArgs, "getmininginfo")) {
obj.pushKV("errors", GetWarnings("statusbar"));
} else {
obj.pushKV("warnings", GetWarnings("statusbar"));
}
return obj;
}

Expand Down
4 changes: 2 additions & 2 deletions src/rpc/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,8 @@ static UniValue getnetworkinfo(const Config &config,
" }\n"
" ,...\n"
" ]\n"
" \"warnings\": \"...\" "
"(string) any network warnings\n"
" \"warnings\": \"...\" (string) any network "
"and blockchain warnings\n"
"}\n"
"\nExamples:\n" +
HelpExampleCli("getnetworkinfo", "") +
Expand Down
Loading