scripted-diff: Remove trailing whitespaces

-BEGIN VERIFY SCRIPT-

sed --in-place'' --regexp-extended 's/[[:space:]]+$//g' $(git grep -I --files-with-matches --extended-regexp '[[:space:]]+$' -- src test  ':!*.svg' ':!src/crypto/sha256_sse4*' ':!src/leveldb' ':!src/qt/locale' ':!src/secp256k1' ':!src/univalue')

-END VERIFY SCRIPT-
This commit is contained in:
João Barbosa 2018-07-24 16:59:49 +01:00
parent 5f7575e263
commit 12dd101345
46 changed files with 152 additions and 152 deletions

View file

@ -357,7 +357,7 @@ if ENABLE_WALLET
BITCOIN_QT_CPP += $(BITCOIN_QT_WALLET_CPP) BITCOIN_QT_CPP += $(BITCOIN_QT_WALLET_CPP)
endif endif
RES_IMAGES = RES_IMAGES =
RES_MOVIES = $(wildcard $(srcdir)/qt/res/movies/spinner-*.png) RES_MOVIES = $(wildcard $(srcdir)/qt/res/movies/spinner-*.png)

View file

@ -356,7 +356,7 @@ CAddrInfo CAddrMan::Select_(bool newOnly)
// Use a 50% chance for choosing between tried and new table entries. // Use a 50% chance for choosing between tried and new table entries.
if (!newOnly && if (!newOnly &&
(nTried > 0 && (nNew == 0 || RandomInt(2) == 0))) { (nTried > 0 && (nNew == 0 || RandomInt(2) == 0))) {
// use a tried node // use a tried node
double fChanceFactor = 1.0; double fChanceFactor = 1.0;
while (1) { while (1) {

View file

@ -182,8 +182,8 @@ public:
//! the maximum number of tried addr collisions to store //! the maximum number of tried addr collisions to store
#define ADDRMAN_SET_TRIED_COLLISION_SIZE 10 #define ADDRMAN_SET_TRIED_COLLISION_SIZE 10
/** /**
* Stochastical (IP) address manager * Stochastical (IP) address manager
*/ */
class CAddrMan class CAddrMan
{ {

View file

@ -148,7 +148,7 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx)
const CTxOut& txout = tx.vout[i]; const CTxOut& txout = tx.vout[i];
// Match if the filter contains any arbitrary script data element in any scriptPubKey in tx // Match if the filter contains any arbitrary script data element in any scriptPubKey in tx
// If this matches, also add the specific output that was matched. // If this matches, also add the specific output that was matched.
// This means clients don't have to update the filter themselves when a new relevant tx // This means clients don't have to update the filter themselves when a new relevant tx
// is discovered in order to find spending transactions, which avoids round-tripping and race conditions. // is discovered in order to find spending transactions, which avoids round-tripping and race conditions.
CScript::const_iterator pc = txout.scriptPubKey.begin(); CScript::const_iterator pc = txout.scriptPubKey.begin();
std::vector<unsigned char> data; std::vector<unsigned char> data;

View file

@ -33,9 +33,9 @@ enum bloomflags
/** /**
* BloomFilter is a probabilistic filter which SPV clients provide * BloomFilter is a probabilistic filter which SPV clients provide
* so that we can filter the transactions we send them. * so that we can filter the transactions we send them.
* *
* This allows for significantly more efficient transaction and block downloads. * This allows for significantly more efficient transaction and block downloads.
* *
* Because bloom filters are probabilistic, a SPV node can increase the false- * Because bloom filters are probabilistic, a SPV node can increase the false-
* positive rate, making us send it transactions which aren't actually its, * positive rate, making us send it transactions which aren't actually its,
* allowing clients to trade more bandwidth for more privacy by obfuscating which * allowing clients to trade more bandwidth for more privacy by obfuscating which

View file

@ -16,7 +16,7 @@
template <typename T> template <typename T>
class CCheckQueueControl; class CCheckQueueControl;
/** /**
* Queue for verifications that have to be performed. * Queue for verifications that have to be performed.
* The verifications are represented by a type T, which must provide an * The verifications are represented by a type T, which must provide an
* operator(), returning a bool. * operator(), returning a bool.
@ -163,7 +163,7 @@ public:
}; };
/** /**
* RAII-style controller object for a CCheckQueue that guarantees the passed * RAII-style controller object for a CCheckQueue that guarantees the passed
* queue is finished before continuing. * queue is finished before continuing.
*/ */

View file

@ -81,8 +81,8 @@ std::string FormatFullVersion()
return CLIENT_BUILD; return CLIENT_BUILD;
} }
/** /**
* Format the subversion field according to BIP 14 spec (https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki) * Format the subversion field according to BIP 14 spec (https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki)
*/ */
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments) std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments)
{ {

View file

@ -203,7 +203,7 @@ class CCoinsViewCache : public CCoinsViewBacked
protected: protected:
/** /**
* Make mutable so that we can "fill the cache" even from Get-methods * Make mutable so that we can "fill the cache" even from Get-methods
* declared as "const". * declared as "const".
*/ */
mutable uint256 hashBlock; mutable uint256 hashBlock;
mutable CCoinsMap cacheCoins; mutable CCoinsMap cacheCoins;
@ -280,7 +280,7 @@ public:
//! Calculate the size of the cache (in bytes) //! Calculate the size of the cache (in bytes)
size_t DynamicMemoryUsage() const; size_t DynamicMemoryUsage() const;
/** /**
* Amount of bitcoins coming in to a transaction * Amount of bitcoins coming in to a transaction
* Note that lightweight clients may not know anything besides the hash of previous transactions, * Note that lightweight clients may not know anything besides the hash of previous transactions,
* so may not be able to calculate this. * so may not be able to calculate this.

View file

@ -41,7 +41,7 @@ unsigned int GetLegacySigOpCount(const CTransaction& tx);
/** /**
* Count ECDSA signature operations in pay-to-script-hash inputs. * Count ECDSA signature operations in pay-to-script-hash inputs.
* *
* @param[in] mapInputs Map of previous transactions that have outputs we're spending * @param[in] mapInputs Map of previous transactions that have outputs we're spending
* @return maximum number of sigops required to validate this transaction's inputs * @return maximum number of sigops required to validate this transaction's inputs
* @see CTransaction::FetchInputs * @see CTransaction::FetchInputs

View file

@ -105,7 +105,7 @@ static bool CheckTxScriptsSanity(const CMutableTransaction& tx)
return false; return false;
} }
} }
return true; return true;
} }
@ -140,7 +140,7 @@ bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no
// Fall through. // Fall through.
} }
} }
return false; return false;
} }

View file

@ -86,7 +86,7 @@ static void JSONErrorReply(HTTPRequest* req, const UniValue& objError, const Uni
//This function checks username and password against -rpcauth //This function checks username and password against -rpcauth
//entries from config file. //entries from config file.
static bool multiUserAuthorized(std::string strUserPass) static bool multiUserAuthorized(std::string strUserPass)
{ {
if (strUserPass.find(':') == std::string::npos) { if (strUserPass.find(':') == std::string::npos) {
return false; return false;
} }

View file

@ -70,7 +70,7 @@ public:
// since it is a constant time operation in C++11. For more details, see // since it is a constant time operation in C++11. For more details, see
// https://stackoverflow.com/questions/765148/how-to-remove-constness-of-const-iterator // https://stackoverflow.com/questions/765148/how-to-remove-constness-of-const-iterator
iterator itTarget = map.erase(itIn, itIn); iterator itTarget = map.erase(itIn, itIn);
if (itTarget == map.end()) if (itTarget == map.end())
return; return;
std::pair<rmap_iterator, rmap_iterator> itPair = rmap.equal_range(itTarget->second); std::pair<rmap_iterator, rmap_iterator> itPair = rmap.equal_range(itTarget->second);

View file

@ -470,13 +470,13 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
} }
#endif // ENABLE_WALLET #endif // ENABLE_WALLET
unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel()); unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel());
OptionsModel* optionsModel = _clientModel->getOptionsModel(); OptionsModel* optionsModel = _clientModel->getOptionsModel();
if(optionsModel) if(optionsModel)
{ {
// be aware of the tray icon disable state change reported by the OptionsModel object. // be aware of the tray icon disable state change reported by the OptionsModel object.
connect(optionsModel,SIGNAL(hideTrayIconChanged(bool)),this,SLOT(setTrayIconVisible(bool))); connect(optionsModel,SIGNAL(hideTrayIconChanged(bool)),this,SLOT(setTrayIconVisible(bool)));
// initialize the disable state of the tray icon with the current value in the model. // initialize the disable state of the tray icon with the current value in the model.
setTrayIconVisible(optionsModel->getHideTrayIcon()); setTrayIconVisible(optionsModel->getHideTrayIcon());
} }
@ -1057,7 +1057,7 @@ void BitcoinGUI::setHDStatus(int hdEnabled)
labelWalletHDStatusIcon->setPixmap(platformStyle->SingleColorIcon(hdEnabled ? ":/icons/hd_enabled" : ":/icons/hd_disabled").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelWalletHDStatusIcon->setPixmap(platformStyle->SingleColorIcon(hdEnabled ? ":/icons/hd_enabled" : ":/icons/hd_disabled").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelWalletHDStatusIcon->setToolTip(hdEnabled ? tr("HD key generation is <b>enabled</b>") : tr("HD key generation is <b>disabled</b>")); labelWalletHDStatusIcon->setToolTip(hdEnabled ? tr("HD key generation is <b>enabled</b>") : tr("HD key generation is <b>disabled</b>"));
// eventually disable the QLabel to set its opacity to 50% // eventually disable the QLabel to set its opacity to 50%
labelWalletHDStatusIcon->setEnabled(hdEnabled); labelWalletHDStatusIcon->setEnabled(hdEnabled);
} }

View file

@ -262,7 +262,7 @@ private Q_SLOTS:
/** Show progress dialog e.g. for verifychain */ /** Show progress dialog e.g. for verifychain */
void showProgress(const QString &title, int nProgress); void showProgress(const QString &title, int nProgress);
/** When hideTrayIcon setting is changed in OptionsModel hide or show the icon accordingly. */ /** When hideTrayIcon setting is changed in OptionsModel hide or show the icon accordingly. */
void setTrayIconVisible(bool); void setTrayIconVisible(bool);

View file

@ -381,12 +381,12 @@ bool openBitcoinConf()
/* Create the file */ /* Create the file */
boost::filesystem::ofstream configFile(pathConfig, std::ios_base::app); boost::filesystem::ofstream configFile(pathConfig, std::ios_base::app);
if (!configFile.good()) if (!configFile.good())
return false; return false;
configFile.close(); configFile.close();
/* Open bitcoin.conf with the associated application */ /* Open bitcoin.conf with the associated application */
return QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig))); return QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig)));
} }
@ -741,7 +741,7 @@ LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef
if (listSnapshot == nullptr) { if (listSnapshot == nullptr) {
return nullptr; return nullptr;
} }
// loop through the list of startup items and try to find the bitcoin app // loop through the list of startup items and try to find the bitcoin app
for(int i = 0; i < CFArrayGetCount(listSnapshot); i++) { for(int i = 0; i < CFArrayGetCount(listSnapshot); i++) {
LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i); LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i);
@ -769,7 +769,7 @@ LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef
CFRelease(currentItemURL); CFRelease(currentItemURL);
} }
} }
CFRelease(listSnapshot); CFRelease(listSnapshot);
return nullptr; return nullptr;
} }
@ -780,7 +780,7 @@ bool GetStartOnSystemStartup()
if (bitcoinAppUrl == nullptr) { if (bitcoinAppUrl == nullptr) {
return false; return false;
} }
LSSharedFileListRef loginItems = LSSharedFileListCreate(nullptr, kLSSharedFileListSessionLoginItems, nullptr); LSSharedFileListRef loginItems = LSSharedFileListCreate(nullptr, kLSSharedFileListSessionLoginItems, nullptr);
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl); LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);
@ -794,7 +794,7 @@ bool SetStartOnSystemStartup(bool fAutoStart)
if (bitcoinAppUrl == nullptr) { if (bitcoinAppUrl == nullptr) {
return false; return false;
} }
LSSharedFileListRef loginItems = LSSharedFileListCreate(nullptr, kLSSharedFileListSessionLoginItems, nullptr); LSSharedFileListRef loginItems = LSSharedFileListCreate(nullptr, kLSSharedFileListSessionLoginItems, nullptr);
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl); LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);
@ -806,7 +806,7 @@ bool SetStartOnSystemStartup(bool fAutoStart)
// remove item // remove item
LSSharedFileListItemRemove(loginItems, foundItem); LSSharedFileListItemRemove(loginItems, foundItem);
} }
CFRelease(bitcoinAppUrl); CFRelease(bitcoinAppUrl);
return true; return true;
} }
@ -967,7 +967,7 @@ void ClickableLabel::mouseReleaseEvent(QMouseEvent *event)
{ {
Q_EMIT clicked(event->pos()); Q_EMIT clicked(event->pos());
} }
void ClickableProgressBar::mouseReleaseEvent(QMouseEvent *event) void ClickableProgressBar::mouseReleaseEvent(QMouseEvent *event)
{ {
Q_EMIT clicked(event->pos()); Q_EMIT clicked(event->pos());

View file

@ -219,11 +219,11 @@ namespace GUIUtil
protected: protected:
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event);
}; };
class ClickableProgressBar : public QProgressBar class ClickableProgressBar : public QProgressBar
{ {
Q_OBJECT Q_OBJECT
Q_SIGNALS: Q_SIGNALS:
/** Emitted when the progressbar is clicked. The relative mouse coordinates of the click are /** Emitted when the progressbar is clicked. The relative mouse coordinates of the click are
* passed to the signal. * passed to the signal.

View file

@ -19,9 +19,9 @@ static MacDockIconHandler *s_instance = nullptr;
bool dockClickHandler(id self,SEL _cmd,...) { bool dockClickHandler(id self,SEL _cmd,...) {
Q_UNUSED(self) Q_UNUSED(self)
Q_UNUSED(_cmd) Q_UNUSED(_cmd)
s_instance->handleDockIconClickEvent(); s_instance->handleDockIconClickEvent();
// Return NO (false) to suppress the default OS X actions // Return NO (false) to suppress the default OS X actions
return false; return false;
} }
@ -29,7 +29,7 @@ bool dockClickHandler(id self,SEL _cmd,...) {
void setupDockClickHandler() { void setupDockClickHandler() {
Class cls = objc_getClass("NSApplication"); Class cls = objc_getClass("NSApplication");
id appInst = objc_msgSend((id)cls, sel_registerName("sharedApplication")); id appInst = objc_msgSend((id)cls, sel_registerName("sharedApplication"));
if (appInst != nullptr) { if (appInst != nullptr) {
id delegate = objc_msgSend(appInst, sel_registerName("delegate")); id delegate = objc_msgSend(appInst, sel_registerName("delegate"));
Class delClass = (Class)objc_msgSend(delegate, sel_registerName("class")); Class delClass = (Class)objc_msgSend(delegate, sel_registerName("class"));

View file

@ -64,7 +64,7 @@ MacNotificationHandler *MacNotificationHandler::instance()
static MacNotificationHandler *s_instance = nullptr; static MacNotificationHandler *s_instance = nullptr;
if (!s_instance) { if (!s_instance) {
s_instance = new MacNotificationHandler(); s_instance = new MacNotificationHandler();
Class aPossibleClass = objc_getClass("NSBundle"); Class aPossibleClass = objc_getClass("NSBundle");
if (aPossibleClass) { if (aPossibleClass) {
// change NSBundle -bundleIdentifier method to return a correct bundle identifier // change NSBundle -bundleIdentifier method to return a correct bundle identifier

View file

@ -104,7 +104,7 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri
ui->progressIncreasePerH->setText(QString::number(progressPerHour * 100, 'f', 2)+"%"); ui->progressIncreasePerH->setText(QString::number(progressPerHour * 100, 'f', 2)+"%");
// show expected remaining time // show expected remaining time
if(remainingMSecs >= 0) { if(remainingMSecs >= 0) {
ui->expectedTimeLeft->setText(GUIUtil::formatNiceTimeOffset(remainingMSecs / 1000.0)); ui->expectedTimeLeft->setText(GUIUtil::formatNiceTimeOffset(remainingMSecs / 1000.0));
} else { } else {
ui->expectedTimeLeft->setText(QObject::tr("unknown")); ui->expectedTimeLeft->setText(QObject::tr("unknown"));

View file

@ -50,7 +50,7 @@ private Q_SLOTS:
void on_openBitcoinConfButton_clicked(); void on_openBitcoinConfButton_clicked();
void on_okButton_clicked(); void on_okButton_clicked();
void on_cancelButton_clicked(); void on_cancelButton_clicked();
void on_hideTrayIcon_stateChanged(int fState); void on_hideTrayIcon_stateChanged(int fState);
void togglePruneWarning(bool enabled); void togglePruneWarning(bool enabled);

View file

@ -57,7 +57,7 @@ void OptionsModel::Init(bool resetSettings)
settings.setValue("fHideTrayIcon", false); settings.setValue("fHideTrayIcon", false);
fHideTrayIcon = settings.value("fHideTrayIcon").toBool(); fHideTrayIcon = settings.value("fHideTrayIcon").toBool();
Q_EMIT hideTrayIconChanged(fHideTrayIcon); Q_EMIT hideTrayIconChanged(fHideTrayIcon);
if (!settings.contains("fMinimizeToTray")) if (!settings.contains("fMinimizeToTray"))
settings.setValue("fMinimizeToTray", false); settings.setValue("fMinimizeToTray", false);
fMinimizeToTray = settings.value("fMinimizeToTray").toBool() && !fHideTrayIcon; fMinimizeToTray = settings.value("fMinimizeToTray").toBool() && !fHideTrayIcon;

View file

@ -34,7 +34,7 @@ public Q_SLOTS:
Q_SIGNALS: Q_SIGNALS:
void validationDidChange(QValidatedLineEdit *validatedLineEdit); void validationDidChange(QValidatedLineEdit *validatedLineEdit);
private Q_SLOTS: private Q_SLOTS:
void markValid(); void markValid();
void checkValidity(); void checkValidity();

View file

@ -80,7 +80,7 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *)
const QString units = tr("KB/s"); const QString units = tr("KB/s");
const float yMarginText = 2.0; const float yMarginText = 2.0;
// draw lines // draw lines
painter.setPen(axisCol); painter.setPen(axisCol);
painter.drawText(XMARGIN, YMARGIN + h - h * val / fMax-yMarginText, QString("%1 %2").arg(val).arg(units)); painter.drawText(XMARGIN, YMARGIN + h - h * val / fMax-yMarginText, QString("%1 %2").arg(val).arg(units));

View file

@ -107,7 +107,7 @@ void WalletView::setBitcoinGUI(BitcoinGUI *gui)
// Pass through transaction notifications // Pass through transaction notifications
connect(this, SIGNAL(incomingTransaction(QString,int,CAmount,QString,QString,QString,QString)), gui, SLOT(incomingTransaction(QString,int,CAmount,QString,QString,QString,QString))); connect(this, SIGNAL(incomingTransaction(QString,int,CAmount,QString,QString,QString,QString)), gui, SLOT(incomingTransaction(QString,int,CAmount,QString,QString,QString,QString)));
// Connect HD enabled state signal // Connect HD enabled state signal
connect(this, SIGNAL(hdEnabledStatusChanged()), gui, SLOT(updateWalletStatus())); connect(this, SIGNAL(hdEnabledStatusChanged()), gui, SLOT(updateWalletStatus()));
} }
} }

View file

@ -5,7 +5,7 @@
/** /**
* Template used for reverse iteration in C++11 range-based for loops. * Template used for reverse iteration in C++11 range-based for loops.
* *
* std::vector<int> v = {1, 2, 3, 4, 5}; * std::vector<int> v = {1, 2, 3, 4, 5};
* for (auto x : reverse_iterate(v)) * for (auto x : reverse_iterate(v))
* std::cout << x << " "; * std::cout << x << " ";
@ -15,21 +15,21 @@ template <typename T>
class reverse_range class reverse_range
{ {
T &m_x; T &m_x;
public: public:
explicit reverse_range(T &x) : m_x(x) {} explicit reverse_range(T &x) : m_x(x) {}
auto begin() const -> decltype(this->m_x.rbegin()) auto begin() const -> decltype(this->m_x.rbegin())
{ {
return m_x.rbegin(); return m_x.rbegin();
} }
auto end() const -> decltype(this->m_x.rend()) auto end() const -> decltype(this->m_x.rend())
{ {
return m_x.rend(); return m_x.rend();
} }
}; };
template <typename T> template <typename T>
reverse_range<T> reverse_iterate(T &x) reverse_range<T> reverse_iterate(T &x)
{ {

View file

@ -99,7 +99,7 @@ bool static IsCompressedPubKey(const valtype &vchPubKey) {
* Where R and S are not negative (their first byte has its highest bit not set), and not * Where R and S are not negative (their first byte has its highest bit not set), and not
* excessively padded (do not start with a 0 byte, unless an otherwise negative number follows, * excessively padded (do not start with a 0 byte, unless an otherwise negative number follows,
* in which case a single 0 byte is necessary and even required). * in which case a single 0 byte is necessary and even required).
* *
* See https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623 * See https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623
* *
* This function is consensus-critical since BIP66. * This function is consensus-critical since BIP66.
@ -139,7 +139,7 @@ bool static IsValidSignatureEncoding(const std::vector<unsigned char> &sig) {
// Verify that the length of the signature matches the sum of the length // Verify that the length of the signature matches the sum of the length
// of the elements. // of the elements.
if ((size_t)(lenR + lenS + 7) != sig.size()) return false; if ((size_t)(lenR + lenS + 7) != sig.size()) return false;
// Check whether the R element is an integer. // Check whether the R element is an integer.
if (sig[2] != 0x02) return false; if (sig[2] != 0x02) return false;
@ -899,7 +899,7 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
popstack(stack); popstack(stack);
stack.push_back(vchHash); stack.push_back(vchHash);
} }
break; break;
case OP_CODESEPARATOR: case OP_CODESEPARATOR:
{ {

View file

@ -173,11 +173,11 @@ template<typename X> const X& ReadWriteAsHelper(const X& x) { return x; }
#define READWRITE(...) (::SerReadWriteMany(s, ser_action, __VA_ARGS__)) #define READWRITE(...) (::SerReadWriteMany(s, ser_action, __VA_ARGS__))
#define READWRITEAS(type, obj) (::SerReadWriteMany(s, ser_action, ReadWriteAsHelper<type>(obj))) #define READWRITEAS(type, obj) (::SerReadWriteMany(s, ser_action, ReadWriteAsHelper<type>(obj)))
/** /**
* Implement three methods for serializable objects. These are actually wrappers over * Implement three methods for serializable objects. These are actually wrappers over
* "SerializationOp" template, which implements the body of each class' serialization * "SerializationOp" template, which implements the body of each class' serialization
* code. Adding "ADD_SERIALIZE_METHODS" in the body of the class causes these wrappers to be * code. Adding "ADD_SERIALIZE_METHODS" in the body of the class causes these wrappers to be
* added as members. * added as members.
*/ */
#define ADD_SERIALIZE_METHODS \ #define ADD_SERIALIZE_METHODS \
template<typename Stream> \ template<typename Stream> \
@ -312,16 +312,16 @@ uint64_t ReadCompactSize(Stream& is)
* sure the encoding is one-to-one, one is subtracted from all but the last digit. * sure the encoding is one-to-one, one is subtracted from all but the last digit.
* Thus, the byte sequence a[] with length len, where all but the last byte * Thus, the byte sequence a[] with length len, where all but the last byte
* has bit 128 set, encodes the number: * has bit 128 set, encodes the number:
* *
* (a[len-1] & 0x7F) + sum(i=1..len-1, 128^i*((a[len-i-1] & 0x7F)+1)) * (a[len-1] & 0x7F) + sum(i=1..len-1, 128^i*((a[len-i-1] & 0x7F)+1))
* *
* Properties: * Properties:
* * Very small (0-127: 1 byte, 128-16511: 2 bytes, 16512-2113663: 3 bytes) * * Very small (0-127: 1 byte, 128-16511: 2 bytes, 16512-2113663: 3 bytes)
* * Every integer has exactly one encoding * * Every integer has exactly one encoding
* * Encoding does not depend on size of original integer type * * Encoding does not depend on size of original integer type
* * No redundancy: every (infinite) byte sequence corresponds to a list * * No redundancy: every (infinite) byte sequence corresponds to a list
* of encoded integers. * of encoded integers.
* *
* 0: [0x00] 256: [0x81 0x00] * 0: [0x00] 256: [0x81 0x00]
* 1: [0x01] 16383: [0xFE 0x7F] * 1: [0x01] 16383: [0xFE 0x7F]
* 127: [0x7F] 16384: [0xFF 0x00] * 127: [0x7F] 16384: [0xFF 0x00]

View file

@ -348,7 +348,7 @@ public:
if (nReadPosNext > vch.size()) { if (nReadPosNext > vch.size()) {
throw std::ios_base::failure("CDataStream::read(): end of data"); throw std::ios_base::failure("CDataStream::read(): end of data");
} }
memcpy(pch, &vch[nReadPos], nSize); memcpy(pch, &vch[nReadPos], nSize);
if (nReadPosNext == vch.size()) if (nReadPosNext == vch.size())
{ {
nReadPos = 0; nReadPos = 0;
@ -456,7 +456,7 @@ private:
const int nType; const int nType;
const int nVersion; const int nVersion;
FILE* file; FILE* file;
public: public:
CAutoFile(FILE* filenew, int nTypeIn, int nVersionIn) : nType(nTypeIn), nVersion(nVersionIn) CAutoFile(FILE* filenew, int nTypeIn, int nVersionIn) : nType(nTypeIn), nVersion(nVersionIn)

View file

@ -42,12 +42,12 @@ unit tests as possible).
The build system is setup to compile an executable called `test_bitcoin` The build system is setup to compile an executable called `test_bitcoin`
that runs all of the unit tests. The main source file is called that runs all of the unit tests. The main source file is called
test_bitcoin.cpp. To add a new unit test file to our test suite you need test_bitcoin.cpp. To add a new unit test file to our test suite you need
to add the file to `src/Makefile.test.include`. The pattern is to create to add the file to `src/Makefile.test.include`. The pattern is to create
one test file for each class or source file for which you want to create one test file for each class or source file for which you want to create
unit tests. The file naming convention is `<source_filename>_tests.cpp` unit tests. The file naming convention is `<source_filename>_tests.cpp`
and such files should wrap their tests in a test suite and such files should wrap their tests in a test suite
called `<source_filename>_tests`. For an example of this pattern, called `<source_filename>_tests`. For an example of this pattern,
examine `uint256_tests.cpp`. examine `uint256_tests.cpp`.
For further reading, I found the following website to be helpful in For further reading, I found the following website to be helpful in

View file

@ -1,151 +1,151 @@
[ [
[ [
"" ""
], ],
[ [
"x" "x"
], ],
[ [
"37qgekLpCCHrQuSjvX3fs496FWTGsHFHizjJAs6NPcR47aefnnCWECAhHV6E3g4YN7u7Yuwod5Y" "37qgekLpCCHrQuSjvX3fs496FWTGsHFHizjJAs6NPcR47aefnnCWECAhHV6E3g4YN7u7Yuwod5Y"
], ],
[ [
"dzb7VV1Ui55BARxv7ATxAtCUeJsANKovDGWFVgpTbhq9gvPqP3yv" "dzb7VV1Ui55BARxv7ATxAtCUeJsANKovDGWF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zXBT" "nbuzhfwMoNzA3PaFnyLcRxE9bTJPDkjZ6Rf6Y6o2ckXZfzZzXBT"
], ],
[ [
"cQN9PoxZeCWK1x56xnz6QYAsvR11XAce3Ehp3gMUdfSQ53Y2mPzx" "cQN9PoxZeCWK1x56xnz6QYAsvR11XAce3Ehp3gMUdfSQ53Y2mPzx"
], ],
[ [
"1Gm3N3rkef6iMbx4voBzaxtXcmmiMTqZPhcuAepRzYUJQW4qRpEnHvMojzof42hjFRf8PE2jPde" "1Gm3N3rkef6iMbx4voBzaxtXcmmiMTqZPhcuAepRzYUJQW4qRpEnHvMojzof42hjFRf8PE2jPde"
], ],
[ [
"2TAq2tuN6x6m233bpT7yqdYQPELdTDJn1eU" "2TAq2tuN6x6m233bpT7yqdYQPELdTDJn1eU"
], ],
[ [
"ntEtnnGhqPii4joABvBtSEJG6BxjT2tUZqE8PcVYgk3RHpgxgHDCQxNbLJf7ardf1dDk2oCQ7Cf" "ntEtnnGhqPii4joABvBtSEJG6BxjT2tUZqE8PcVYgk3RHpgxgHDCQxNbLJf7ardf1dDk2oCQ7Cf"
], ],
[ [
"Ky1YjoZNgQ196HJV3HpdkecfhRBmRZdMJk89Hi5KGfpfPwS2bUbfd" "Ky1YjoZNgQ196HJV3HpdkecfhRBmRZdMJk89Hi5KGfpfPwS2bUbfd"
], ],
[ [
"2A1q1YsMZowabbvta7kTy2Fd6qN4r5ZCeG3qLpvZBMzCixMUdkN2Y4dHB1wPsZAeVXUGD83MfRED" "2A1q1YsMZowabbvta7kTy2Fd6qN4r5ZCeG3qLpvZBMzCixMUdkN2Y4dHB1wPsZAeVXUGD83MfRED"
], ],

View file

@ -712,7 +712,7 @@
["0x17 0x3014020002107777777777777777777777777777777701", "0 CHECKSIG NOT", "", "OK", "Zero-length R is correctly encoded"], ["0x17 0x3014020002107777777777777777777777777777777701", "0 CHECKSIG NOT", "", "OK", "Zero-length R is correctly encoded"],
["0x17 0x3014021077777777777777777777777777777777020001", "0 CHECKSIG NOT", "", "OK", "Zero-length S is correctly encoded for DERSIG"], ["0x17 0x3014021077777777777777777777777777777777020001", "0 CHECKSIG NOT", "", "OK", "Zero-length S is correctly encoded for DERSIG"],
["0x27 0x302402107777777777777777777777777777777702108777777777777777777777777777777701", "0 CHECKSIG NOT", "", "OK", "Negative S is correctly encoded"], ["0x27 0x302402107777777777777777777777777777777702108777777777777777777777777777777701", "0 CHECKSIG NOT", "", "OK", "Negative S is correctly encoded"],
["2147483648", "CHECKSEQUENCEVERIFY", "CHECKSEQUENCEVERIFY", "OK", "CSV passes if stack top bit 1 << 31 is set"], ["2147483648", "CHECKSEQUENCEVERIFY", "CHECKSEQUENCEVERIFY", "OK", "CSV passes if stack top bit 1 << 31 is set"],
["", "DEPTH", "P2SH,STRICTENC", "EVAL_FALSE", "Test the test: we should have an empty stack after scriptSig evaluation"], ["", "DEPTH", "P2SH,STRICTENC", "EVAL_FALSE", "Test the test: we should have an empty stack after scriptSig evaluation"],

View file

@ -20,9 +20,9 @@ static bool is_null_key(const std::vector<unsigned char>& key) {
return isnull; return isnull;
} }
BOOST_FIXTURE_TEST_SUITE(dbwrapper_tests, BasicTestingSetup) BOOST_FIXTURE_TEST_SUITE(dbwrapper_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(dbwrapper) BOOST_AUTO_TEST_CASE(dbwrapper)
{ {
// Perform tests both obfuscated and non-obfuscated. // Perform tests both obfuscated and non-obfuscated.
@ -142,7 +142,7 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
// Now, set up another wrapper that wants to obfuscate the same directory // Now, set up another wrapper that wants to obfuscate the same directory
CDBWrapper odbw(ph, (1 << 10), false, false, true); CDBWrapper odbw(ph, (1 << 10), false, false, true);
// Check that the key/val we wrote with unobfuscated wrapper exists and // Check that the key/val we wrote with unobfuscated wrapper exists and
// is readable. // is readable.
uint256 res2; uint256 res2;
BOOST_CHECK(odbw.Read(key, res2)); BOOST_CHECK(odbw.Read(key, res2));
@ -153,13 +153,13 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
uint256 in2 = InsecureRand256(); uint256 in2 = InsecureRand256();
uint256 res3; uint256 res3;
// Check that we can write successfully // Check that we can write successfully
BOOST_CHECK(odbw.Write(key, in2)); BOOST_CHECK(odbw.Write(key, in2));
BOOST_CHECK(odbw.Read(key, res3)); BOOST_CHECK(odbw.Read(key, res3));
BOOST_CHECK_EQUAL(res3.ToString(), in2.ToString()); BOOST_CHECK_EQUAL(res3.ToString(), in2.ToString());
} }
// Ensure that we start obfuscating during a reindex. // Ensure that we start obfuscating during a reindex.
BOOST_AUTO_TEST_CASE(existing_data_reindex) BOOST_AUTO_TEST_CASE(existing_data_reindex)
{ {
@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
uint256 in2 = InsecureRand256(); uint256 in2 = InsecureRand256();
uint256 res3; uint256 res3;
// Check that we can write successfully // Check that we can write successfully
BOOST_CHECK(odbw.Write(key, in2)); BOOST_CHECK(odbw.Write(key, in2));
BOOST_CHECK(odbw.Read(key, res3)); BOOST_CHECK(odbw.Read(key, res3));

View file

@ -50,10 +50,10 @@ BOOST_AUTO_TEST_CASE(limitedmap_test)
// use the iterator to check for the expected key and value // use the iterator to check for the expected key and value
BOOST_CHECK(it->first == i); BOOST_CHECK(it->first == i);
BOOST_CHECK(it->second == i + 1); BOOST_CHECK(it->second == i + 1);
// use find to check for the value // use find to check for the value
BOOST_CHECK(map.find(i)->second == i + 1); BOOST_CHECK(map.find(i)->second == i + 1);
// update and recheck // update and recheck
map.update(it, i + 2); map.update(it, i + 2);
BOOST_CHECK(map.find(i)->second == i + 2); BOOST_CHECK(map.find(i)->second == i + 2);

View file

@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
poolSize = testPool.size(); poolSize = testPool.size();
testPool.removeRecursive(txParent); testPool.removeRecursive(txParent);
BOOST_CHECK_EQUAL(testPool.size(), poolSize - 1); BOOST_CHECK_EQUAL(testPool.size(), poolSize - 1);
// Parent, children, grandchildren: // Parent, children, grandchildren:
testPool.addUnchecked(txParent.GetHash(), entry.FromTx(txParent)); testPool.addUnchecked(txParent.GetHash(), entry.FromTx(txParent));
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)

View file

@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(cnode_simple_test)
in_addr ipv4Addr; in_addr ipv4Addr;
ipv4Addr.s_addr = 0xa0b0c001; ipv4Addr.s_addr = 0xa0b0c001;
CAddress addr = CAddress(CService(ipv4Addr, 7777), NODE_NETWORK); CAddress addr = CAddress(CService(ipv4Addr, 7777), NODE_NETWORK);
std::string pszDest; std::string pszDest;
bool fInboundIn = false; bool fInboundIn = false;

View file

@ -36,7 +36,7 @@ class prevector_tester {
{ {
local_check(a == b); local_check(a == b);
} }
void local_check(bool b) void local_check(bool b)
{ {
passed &= b; passed &= b;
} }

View file

@ -41,7 +41,7 @@ BOOST_FIXTURE_TEST_SUITE(raii_event_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(raii_event_creation) BOOST_AUTO_TEST_CASE(raii_event_creation)
{ {
event_set_mem_functions(tag_malloc, realloc, tag_free); event_set_mem_functions(tag_malloc, realloc, tag_free);
void* base_ptr = nullptr; void* base_ptr = nullptr;
{ {
auto base = obtain_event_base(); auto base = obtain_event_base();
@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE(raii_event_creation)
BOOST_CHECK(tags[base_ptr] == 1); BOOST_CHECK(tags[base_ptr] == 1);
} }
BOOST_CHECK(tags[base_ptr] == 0); BOOST_CHECK(tags[base_ptr] == 0);
void* event_ptr = nullptr; void* event_ptr = nullptr;
{ {
auto base = obtain_event_base(); auto base = obtain_event_base();
@ -63,14 +63,14 @@ BOOST_AUTO_TEST_CASE(raii_event_creation)
} }
BOOST_CHECK(tags[base_ptr] == 0); BOOST_CHECK(tags[base_ptr] == 0);
BOOST_CHECK(tags[event_ptr] == 0); BOOST_CHECK(tags[event_ptr] == 0);
event_set_mem_functions(malloc, realloc, free); event_set_mem_functions(malloc, realloc, free);
} }
BOOST_AUTO_TEST_CASE(raii_event_order) BOOST_AUTO_TEST_CASE(raii_event_order)
{ {
event_set_mem_functions(tag_malloc, realloc, tag_free); event_set_mem_functions(tag_malloc, realloc, tag_free);
void* base_ptr = nullptr; void* base_ptr = nullptr;
void* event_ptr = nullptr; void* event_ptr = nullptr;
{ {

View file

@ -515,7 +515,7 @@ BOOST_AUTO_TEST_CASE(script_build)
tests.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey0C) << OP_CHECKSIG, tests.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey0C) << OP_CHECKSIG,
"P2SH(P2PK), bad redeemscript", SCRIPT_VERIFY_P2SH, true "P2SH(P2PK), bad redeemscript", SCRIPT_VERIFY_P2SH, true
).PushSig(keys.key0).PushRedeem().DamagePush(10).ScriptError(SCRIPT_ERR_EVAL_FALSE)); ).PushSig(keys.key0).PushRedeem().DamagePush(10).ScriptError(SCRIPT_ERR_EVAL_FALSE));
tests.push_back(TestBuilder(CScript() << OP_DUP << OP_HASH160 << ToByteVector(keys.pubkey0.GetID()) << OP_EQUALVERIFY << OP_CHECKSIG, tests.push_back(TestBuilder(CScript() << OP_DUP << OP_HASH160 << ToByteVector(keys.pubkey0.GetID()) << OP_EQUALVERIFY << OP_CHECKSIG,
"P2SH(P2PKH)", SCRIPT_VERIFY_P2SH, true "P2SH(P2PKH)", SCRIPT_VERIFY_P2SH, true
).PushSig(keys.key0).Push(keys.pubkey0).PushRedeem()); ).PushSig(keys.key0).Push(keys.pubkey0).PushRedeem());

View file

@ -252,8 +252,8 @@ static bool isCanonicalException(const std::ios_base::failure& ex)
// The string returned by what() can be different for different platforms. // The string returned by what() can be different for different platforms.
// Instead of directly comparing the ex.what() with an expected string, // Instead of directly comparing the ex.what() with an expected string,
// create an instance of exception to see if ex.what() matches // create an instance of exception to see if ex.what() matches
// the expected explanatory string returned by the exception instance. // the expected explanatory string returned by the exception instance.
return strcmp(expectedException.what(), ex.what()) == 0; return strcmp(expectedException.what(), ex.what()) == 0;
} }

View file

@ -76,19 +76,19 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
CDataStream ds(in, 0, 0); CDataStream ds(in, 0, 0);
// Degenerate case // Degenerate case
key.push_back('\x00'); key.push_back('\x00');
key.push_back('\x00'); key.push_back('\x00');
ds.Xor(key); ds.Xor(key);
BOOST_CHECK_EQUAL( BOOST_CHECK_EQUAL(
std::string(expected_xor.begin(), expected_xor.end()), std::string(expected_xor.begin(), expected_xor.end()),
std::string(ds.begin(), ds.end())); std::string(ds.begin(), ds.end()));
in.push_back('\x0f'); in.push_back('\x0f');
in.push_back('\xf0'); in.push_back('\xf0');
expected_xor.push_back('\xf0'); expected_xor.push_back('\xf0');
expected_xor.push_back('\x0f'); expected_xor.push_back('\x0f');
// Single character key // Single character key
ds.clear(); ds.clear();
@ -98,9 +98,9 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
key.push_back('\xff'); key.push_back('\xff');
ds.Xor(key); ds.Xor(key);
BOOST_CHECK_EQUAL( BOOST_CHECK_EQUAL(
std::string(expected_xor.begin(), expected_xor.end()), std::string(expected_xor.begin(), expected_xor.end()),
std::string(ds.begin(), ds.end())); std::string(ds.begin(), ds.end()));
// Multi character key // Multi character key
in.clear(); in.clear();
@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
in.push_back('\x0f'); in.push_back('\x0f');
expected_xor.push_back('\x0f'); expected_xor.push_back('\x0f');
expected_xor.push_back('\x00'); expected_xor.push_back('\x00');
ds.clear(); ds.clear();
ds.insert(ds.begin(), in.begin(), in.end()); ds.insert(ds.begin(), in.begin(), in.end());
@ -119,8 +119,8 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
ds.Xor(key); ds.Xor(key);
BOOST_CHECK_EQUAL( BOOST_CHECK_EQUAL(
std::string(expected_xor.begin(), expected_xor.end()), std::string(expected_xor.begin(), expected_xor.end()),
std::string(ds.begin(), ds.end())); std::string(ds.begin(), ds.end()));
} }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()

View file

@ -14,7 +14,7 @@ static const int64_t DEFAULT_MAX_TIME_ADJUSTMENT = 70 * 60;
class CNetAddr; class CNetAddr;
/** /**
* Median filter over a stream of values. * Median filter over a stream of values.
* Returns the median of the last N numbers * Returns the median of the last N numbers
*/ */

View file

@ -53,7 +53,7 @@ struct CoinEntry {
} }
CCoinsViewDB::CCoinsViewDB(size_t nCacheSize, bool fMemory, bool fWipe) : db(GetDataDir() / "chainstate", nCacheSize, fMemory, fWipe, true) CCoinsViewDB::CCoinsViewDB(size_t nCacheSize, bool fMemory, bool fWipe) : db(GetDataDir() / "chainstate", nCacheSize, fMemory, fWipe, true)
{ {
} }

View file

@ -284,7 +284,7 @@ void CTxMemPool::UpdateForRemoveFromMempool(const setEntries &entriesToRemove, b
// should be a bit faster. // should be a bit faster.
// However, if we happen to be in the middle of processing a reorg, then // However, if we happen to be in the middle of processing a reorg, then
// the mempool can be in an inconsistent state. In this case, the set // the mempool can be in an inconsistent state. In this case, the set
// of ancestors reachable via mapLinks will be the same as the set of // of ancestors reachable via mapLinks will be the same as the set of
// ancestors whose packages include this transaction, because when we // ancestors whose packages include this transaction, because when we
// add a new transaction to the mempool in addUnchecked(), we assume it // add a new transaction to the mempool in addUnchecked(), we assume it
// has no children, and in the case of a reorg where that assumption is // has no children, and in the case of a reorg where that assumption is

View file

@ -692,7 +692,7 @@ private:
void removeUnchecked(txiter entry, MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN) EXCLUSIVE_LOCKS_REQUIRED(cs); void removeUnchecked(txiter entry, MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN) EXCLUSIVE_LOCKS_REQUIRED(cs);
}; };
/** /**
* CCoinsView that brings transactions from a mempool into view. * CCoinsView that brings transactions from a mempool into view.
* It does not check for spendings by memory pool transactions. * It does not check for spendings by memory pool transactions.
* Instead, it provides access to all Coins which are either unspent in the * Instead, it provides access to all Coins which are either unspent in the

View file

@ -207,7 +207,7 @@ static const unsigned int DEFAULT_CHECKLEVEL = 3;
// Setting the target to > than 550MB will make it likely we can respect the target. // Setting the target to > than 550MB will make it likely we can respect the target.
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024; static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024;
/** /**
* Process an incoming block. This only returns after the best known valid * Process an incoming block. This only returns after the best known valid
* block is made active. Note that it does not, however, guarantee that the * block is made active. Note that it does not, however, guarantee that the
* specific block passed to it has been checked for validity! * specific block passed to it has been checked for validity!
@ -218,7 +218,7 @@ static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024;
* *
* Note that we guarantee that either the proof-of-work is valid on pblock, or * Note that we guarantee that either the proof-of-work is valid on pblock, or
* (and possibly also) BlockChecked will have been called. * (and possibly also) BlockChecked will have been called.
* *
* May not be called in a * May not be called in a
* validationinterface callback. * validationinterface callback.
* *
@ -351,7 +351,7 @@ bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp = null
/** /**
* Closure representing one script verification * Closure representing one script verification
* Note that this stores references to the spending transaction * Note that this stores references to the spending transaction
*/ */
class CScriptCheck class CScriptCheck
{ {

View file

@ -5,7 +5,7 @@ etc.
There are currently two sets of tests in this directory: There are currently two sets of tests in this directory:
- [functional](/test/functional) which test the functionality of - [functional](/test/functional) which test the functionality of
bitcoind and bitcoin-qt by interacting with them through the RPC and P2P bitcoind and bitcoin-qt by interacting with them through the RPC and P2P
interfaces. interfaces.
- [util](/test/util) which tests the bitcoin utilities, currently only - [util](/test/util) which tests the bitcoin utilities, currently only
@ -177,11 +177,11 @@ Note: gdb attach step may require `sudo`
### Util tests ### Util tests
Util tests can be run locally by running `test/util/bitcoin-util-test.py`. Util tests can be run locally by running `test/util/bitcoin-util-test.py`.
Use the `-v` option for verbose output. Use the `-v` option for verbose output.
# Writing functional tests # Writing functional tests
You are encouraged to write functional tests for new or existing features. You are encouraged to write functional tests for new or existing features.
Further information about the functional test framework and individual Further information about the functional test framework and individual
tests is found in [test/functional](/test/functional). tests is found in [test/functional](/test/functional).