aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.qt.include18
-rw-r--r--src/blockencodings.cpp4
-rw-r--r--src/blockencodings.h2
-rw-r--r--src/main.cpp84
-rw-r--r--src/net.cpp1
-rw-r--r--src/net.h1
-rw-r--r--src/prevector.h8
-rw-r--r--src/qt/bitcoingui.cpp2
-rw-r--r--src/qt/clientmodel.cpp2
-rw-r--r--src/qt/modaloverlay.cpp30
-rw-r--r--src/qt/modaloverlay.h3
-rw-r--r--src/qt/rpcconsole.cpp25
-rw-r--r--src/qt/walletframe.h7
-rw-r--r--src/rpc/blockchain.cpp2
-rw-r--r--src/script/bitcoinconsensus.h3
-rw-r--r--src/serialize.h21
-rw-r--r--src/test/bctest.py6
-rwxr-xr-xsrc/test/bitcoin-util-test.py5
-rw-r--r--src/test/blockencodings_tests.cpp6
-rw-r--r--src/test/data/bitcoin-util-test.json84
-rw-r--r--src/txmempool.cpp2
-rw-r--r--src/txmempool.h2
22 files changed, 209 insertions, 109 deletions
diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include
index a2ed4f47d8..1f9a901d75 100644
--- a/src/Makefile.qt.include
+++ b/src/Makefile.qt.include
@@ -289,7 +289,7 @@ RES_ICONS = \
qt/res/icons/warning.png \
qt/res/icons/verify.png
-BITCOIN_QT_CPP = \
+BITCOIN_QT_BASE_CPP = \
qt/bantablemodel.cpp \
qt/bitcoinaddressvalidator.cpp \
qt/bitcoinamountfield.cpp \
@@ -313,12 +313,9 @@ BITCOIN_QT_CPP = \
qt/trafficgraphwidget.cpp \
qt/utilitydialog.cpp
-if TARGET_WINDOWS
-BITCOIN_QT_CPP += qt/winshutdownmonitor.cpp
-endif
+BITCOIN_QT_WINDOWS_CPP = qt/winshutdownmonitor.cpp
-if ENABLE_WALLET
-BITCOIN_QT_CPP += \
+BITCOIN_QT_WALLET_CPP = \
qt/addressbookpage.cpp \
qt/addresstablemodel.cpp \
qt/askpassphrasedialog.cpp \
@@ -345,6 +342,13 @@ BITCOIN_QT_CPP += \
qt/walletmodel.cpp \
qt/walletmodeltransaction.cpp \
qt/walletview.cpp
+
+BITCOIN_QT_CPP = $(BITCOIN_QT_BASE_CPP)
+if TARGET_WINDOWS
+BITCOIN_QT_CPP += $(BITCOIN_QT_WINDOWS_CPP)
+endif
+if ENABLE_WALLET
+BITCOIN_QT_CPP += $(BITCOIN_QT_WALLET_CPP)
endif
RES_IMAGES =
@@ -413,7 +417,7 @@ $(srcdir)/qt/bitcoinstrings.cpp: $(libbitcoin_server_a_SOURCES) $(libbitcoin_wal
@test -n $(XGETTEXT) || echo "xgettext is required for updating translations"
$(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) PACKAGE_NAME="$(PACKAGE_NAME)" COPYRIGHT_HOLDERS="$(COPYRIGHT_HOLDERS)" COPYRIGHT_HOLDERS_SUBSTITUTION="$(COPYRIGHT_HOLDERS_SUBSTITUTION)" $(PYTHON) ../share/qt/extract_strings_qt.py $^
-translate: $(srcdir)/qt/bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
+translate: $(srcdir)/qt/bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_BASE_CPP) $(BITCOIN_QT_WINDOWS_CPP) $(BITCOIN_QT_WALLET_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
@test -n $(LUPDATE) || echo "lupdate is required for updating translations"
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) $^ -locations relative -no-obsolete -ts $(srcdir)/qt/locale/bitcoin_en.ts
diff --git a/src/blockencodings.cpp b/src/blockencodings.cpp
index df237f8f26..93d3fa372b 100644
--- a/src/blockencodings.cpp
+++ b/src/blockencodings.cpp
@@ -17,7 +17,7 @@
#define MIN_TRANSACTION_BASE_SIZE (::GetSerializeSize(CTransaction(), SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS))
-CBlockHeaderAndShortTxIDs::CBlockHeaderAndShortTxIDs(const CBlock& block) :
+CBlockHeaderAndShortTxIDs::CBlockHeaderAndShortTxIDs(const CBlock& block, bool fUseWTXID) :
nonce(GetRand(std::numeric_limits<uint64_t>::max())),
shorttxids(block.vtx.size() - 1), prefilledtxn(1), header(block) {
FillShortTxIDSelector();
@@ -25,7 +25,7 @@ CBlockHeaderAndShortTxIDs::CBlockHeaderAndShortTxIDs(const CBlock& block) :
prefilledtxn[0] = {0, block.vtx[0]};
for (size_t i = 1; i < block.vtx.size(); i++) {
const CTransaction& tx = block.vtx[i];
- shorttxids[i - 1] = GetShortID(tx.GetHash());
+ shorttxids[i - 1] = GetShortID(fUseWTXID ? tx.GetWitnessHash() : tx.GetHash());
}
}
diff --git a/src/blockencodings.h b/src/blockencodings.h
index 349fcbd50f..99b1cb140d 100644
--- a/src/blockencodings.h
+++ b/src/blockencodings.h
@@ -146,7 +146,7 @@ public:
// Dummy for deserialization
CBlockHeaderAndShortTxIDs() {}
- CBlockHeaderAndShortTxIDs(const CBlock& block);
+ CBlockHeaderAndShortTxIDs(const CBlock& block, bool fUseWTXID);
uint64_t GetShortID(const uint256& txhash) const;
diff --git a/src/main.cpp b/src/main.cpp
index ab67219714..c92a38be98 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -289,10 +289,21 @@ struct CNodeState {
bool fPreferHeaders;
//! Whether this peer wants invs or cmpctblocks (when possible) for block announcements.
bool fPreferHeaderAndIDs;
- //! Whether this peer will send us cmpctblocks if we request them
+ /**
+ * Whether this peer will send us cmpctblocks if we request them.
+ * This is not used to gate request logic, as we really only care about fSupportsDesiredCmpctVersion,
+ * but is used as a flag to "lock in" the version of compact blocks (fWantsCmpctWitness) we send.
+ */
bool fProvidesHeaderAndIDs;
//! Whether this peer can give us witnesses
bool fHaveWitness;
+ //! Whether this peer wants witnesses in cmpctblocks/blocktxns
+ bool fWantsCmpctWitness;
+ /**
+ * If we've announced NODE_WITNESS to this peer: whether the peer sends witnesses in cmpctblocks/blocktxns,
+ * otherwise: whether this peer sends non-witnesses in cmpctblocks/blocktxns.
+ */
+ bool fSupportsDesiredCmpctVersion;
CNodeState() {
fCurrentlyConnected = false;
@@ -313,6 +324,8 @@ struct CNodeState {
fPreferHeaderAndIDs = false;
fProvidesHeaderAndIDs = false;
fHaveWitness = false;
+ fWantsCmpctWitness = false;
+ fSupportsDesiredCmpctVersion = false;
}
};
@@ -467,8 +480,8 @@ void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
}
void MaybeSetPeerAsAnnouncingHeaderAndIDs(const CNodeState* nodestate, CNode* pfrom, CConnman& connman) {
- if (pfrom->GetLocalServices() & NODE_WITNESS) {
- // Don't ever request compact blocks when segwit is enabled.
+ if (!nodestate->fSupportsDesiredCmpctVersion) {
+ // Never ask from peers who can't provide witnesses.
return;
}
if (nodestate->fProvidesHeaderAndIDs) {
@@ -476,7 +489,7 @@ void MaybeSetPeerAsAnnouncingHeaderAndIDs(const CNodeState* nodestate, CNode* pf
if (nodeid == pfrom->GetId())
return;
bool fAnnounceUsingCMPCTBLOCK = false;
- uint64_t nCMPCTBLOCKVersion = 1;
+ uint64_t nCMPCTBLOCKVersion = (pfrom->GetLocalServices() & NODE_WITNESS) ? 2 : 1;
if (lNodesAnnouncingHeaderAndIDs.size() >= 3) {
// As per BIP152, we only get 3 of our peers to announce
// blocks using compact encodings.
@@ -4856,11 +4869,12 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
// they wont have a useful mempool to match against a compact block,
// and we don't feel like constructing the object for them, so
// instead we respond with the full, non-compact block.
+ bool fPeerWantsWitness = State(pfrom->GetId())->fWantsCmpctWitness;
if (mi->second->nHeight >= chainActive.Height() - 10) {
- CBlockHeaderAndShortTxIDs cmpctblock(block);
- pfrom->PushMessageWithFlag(SERIALIZE_TRANSACTION_NO_WITNESS, NetMsgType::CMPCTBLOCK, cmpctblock);
+ CBlockHeaderAndShortTxIDs cmpctblock(block, fPeerWantsWitness);
+ pfrom->PushMessageWithFlag(fPeerWantsWitness ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS, NetMsgType::CMPCTBLOCK, cmpctblock);
} else
- pfrom->PushMessageWithFlag(SERIALIZE_TRANSACTION_NO_WITNESS, NetMsgType::BLOCK, block);
+ pfrom->PushMessageWithFlag(fPeerWantsWitness ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS, NetMsgType::BLOCK, block);
}
// Trigger the peer node to send a getblocks request for the next batch of inventory
@@ -4922,7 +4936,7 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
uint32_t GetFetchFlags(CNode* pfrom, CBlockIndex* pprev, const Consensus::Params& chainparams) {
uint32_t nFetchFlags = 0;
- if (IsWitnessEnabled(pprev, chainparams) && State(pfrom->GetId())->fHaveWitness) {
+ if ((pfrom->GetLocalServices() & NODE_WITNESS) && State(pfrom->GetId())->fHaveWitness) {
nFetchFlags |= MSG_WITNESS_FLAG;
}
return nFetchFlags;
@@ -5128,13 +5142,16 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
pfrom->PushMessage(NetMsgType::SENDHEADERS);
}
if (pfrom->nVersion >= SHORT_IDS_BLOCKS_VERSION) {
- // Tell our peer we are willing to provide version-1 cmpctblocks
+ // Tell our peer we are willing to provide version 1 or 2 cmpctblocks
// However, we do not request new block announcements using
// cmpctblock messages.
// We send this to non-NODE NETWORK peers as well, because
// they may wish to request compact blocks from us
bool fAnnounceUsingCMPCTBLOCK = false;
- uint64_t nCMPCTBLOCKVersion = 1;
+ uint64_t nCMPCTBLOCKVersion = 2;
+ if (pfrom->GetLocalServices() & NODE_WITNESS)
+ pfrom->PushMessage(NetMsgType::SENDCMPCT, fAnnounceUsingCMPCTBLOCK, nCMPCTBLOCKVersion);
+ nCMPCTBLOCKVersion = 1;
pfrom->PushMessage(NetMsgType::SENDCMPCT, fAnnounceUsingCMPCTBLOCK, nCMPCTBLOCKVersion);
}
}
@@ -5195,12 +5212,23 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
else if (strCommand == NetMsgType::SENDCMPCT)
{
bool fAnnounceUsingCMPCTBLOCK = false;
- uint64_t nCMPCTBLOCKVersion = 1;
+ uint64_t nCMPCTBLOCKVersion = 0;
vRecv >> fAnnounceUsingCMPCTBLOCK >> nCMPCTBLOCKVersion;
- if (nCMPCTBLOCKVersion == 1) {
+ if (nCMPCTBLOCKVersion == 1 || ((pfrom->GetLocalServices() & NODE_WITNESS) && nCMPCTBLOCKVersion == 2)) {
LOCK(cs_main);
- State(pfrom->GetId())->fProvidesHeaderAndIDs = true;
- State(pfrom->GetId())->fPreferHeaderAndIDs = fAnnounceUsingCMPCTBLOCK;
+ // fProvidesHeaderAndIDs is used to "lock in" version of compact blocks we send (fWantsCmpctWitness)
+ if (!State(pfrom->GetId())->fProvidesHeaderAndIDs) {
+ State(pfrom->GetId())->fProvidesHeaderAndIDs = true;
+ State(pfrom->GetId())->fWantsCmpctWitness = nCMPCTBLOCKVersion == 2;
+ }
+ if (State(pfrom->GetId())->fWantsCmpctWitness == (nCMPCTBLOCKVersion == 2)) // ignore later version announces
+ State(pfrom->GetId())->fPreferHeaderAndIDs = fAnnounceUsingCMPCTBLOCK;
+ if (!State(pfrom->GetId())->fSupportsDesiredCmpctVersion) {
+ if (pfrom->GetLocalServices() & NODE_WITNESS)
+ State(pfrom->GetId())->fSupportsDesiredCmpctVersion = (nCMPCTBLOCKVersion == 2);
+ else
+ State(pfrom->GetId())->fSupportsDesiredCmpctVersion = (nCMPCTBLOCKVersion == 1);
+ }
}
}
@@ -5258,7 +5286,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
nodestate->nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER &&
(!IsWitnessEnabled(chainActive.Tip(), chainparams.GetConsensus()) || State(pfrom->GetId())->fHaveWitness)) {
inv.type |= nFetchFlags;
- if (nodestate->fProvidesHeaderAndIDs && !(pfrom->GetLocalServices() & NODE_WITNESS))
+ if (nodestate->fSupportsDesiredCmpctVersion)
vToFetch.push_back(CInv(MSG_CMPCT_BLOCK, inv.hash));
else
vToFetch.push_back(inv);
@@ -5386,7 +5414,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
resp.txn[i] = block.vtx[req.indexes[i]];
}
- pfrom->PushMessageWithFlag(SERIALIZE_TRANSACTION_NO_WITNESS, NetMsgType::BLOCKTXN, resp);
+ pfrom->PushMessageWithFlag(State(pfrom->GetId())->fWantsCmpctWitness ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS, NetMsgType::BLOCKTXN, resp);
}
@@ -5650,7 +5678,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// We requested this block for some reason, but our mempool will probably be useless
// so we just grab the block via normal getdata
std::vector<CInv> vInv(1);
- vInv[0] = CInv(MSG_BLOCK, cmpctblock.header.GetHash());
+ vInv[0] = CInv(MSG_BLOCK | GetFetchFlags(pfrom, pindex->pprev, chainparams.GetConsensus()), cmpctblock.header.GetHash());
pfrom->PushMessage(NetMsgType::GETDATA, vInv);
}
return true;
@@ -5662,6 +5690,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
CNodeState *nodestate = State(pfrom->GetId());
+ if (IsWitnessEnabled(pindex->pprev, chainparams.GetConsensus()) && !nodestate->fSupportsDesiredCmpctVersion) {
+ // Don't bother trying to process compact blocks from v1 peers
+ // after segwit activates.
+ return true;
+ }
+
// We want to be a bit conservative just to be extra careful about DoS
// possibilities in compact block processing...
if (pindex->nHeight <= chainActive.Height() + 2) {
@@ -5688,7 +5722,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
} else if (status == READ_STATUS_FAILED) {
// Duplicate txindexes, the block is now in-flight, so just request it
std::vector<CInv> vInv(1);
- vInv[0] = CInv(MSG_BLOCK, cmpctblock.header.GetHash());
+ vInv[0] = CInv(MSG_BLOCK | GetFetchFlags(pfrom, pindex->pprev, chainparams.GetConsensus()), cmpctblock.header.GetHash());
pfrom->PushMessage(NetMsgType::GETDATA, vInv);
return true;
}
@@ -5715,7 +5749,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// We requested this block, but its far into the future, so our
// mempool will probably be useless - request the block normally
std::vector<CInv> vInv(1);
- vInv[0] = CInv(MSG_BLOCK, cmpctblock.header.GetHash());
+ vInv[0] = CInv(MSG_BLOCK | GetFetchFlags(pfrom, pindex->pprev, chainparams.GetConsensus()), cmpctblock.header.GetHash());
pfrom->PushMessage(NetMsgType::GETDATA, vInv);
return true;
} else {
@@ -5757,7 +5791,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
} else if (status == READ_STATUS_FAILED) {
// Might have collided, fall back to getdata now :(
std::vector<CInv> invs;
- invs.push_back(CInv(MSG_BLOCK, resp.blockhash));
+ invs.push_back(CInv(MSG_BLOCK | GetFetchFlags(pfrom, chainActive.Tip(), chainparams.GetConsensus()), resp.blockhash));
pfrom->PushMessage(NetMsgType::GETDATA, invs);
} else {
CValidationState state;
@@ -5906,7 +5940,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
pindexLast->GetBlockHash().ToString(), pindexLast->nHeight);
}
if (vGetData.size() > 0) {
- if (nodestate->fProvidesHeaderAndIDs && vGetData.size() == 1 && mapBlocksInFlight.size() == 1 && pindexLast->pprev->IsValid(BLOCK_VALID_CHAIN) && !(pfrom->GetLocalServices() & NODE_WITNESS)) {
+ if (nodestate->fSupportsDesiredCmpctVersion && vGetData.size() == 1 && mapBlocksInFlight.size() == 1 && pindexLast->pprev->IsValid(BLOCK_VALID_CHAIN)) {
// We seem to be rather well-synced, so it appears pfrom was the first to provide us
// with this block! Let's get them to announce using compact blocks in the future.
MaybeSetPeerAsAnnouncingHeaderAndIDs(nodestate, pfrom, connman);
@@ -6351,7 +6385,7 @@ bool SendMessages(CNode* pto, CConnman& connman)
// Ping automatically sent as a latency probe & keepalive.
pingSend = true;
}
- if (pingSend) {
+ if (pingSend && !pto->fDisconnect) {
uint64_t nonce = 0;
while (nonce == 0) {
GetRandBytes((unsigned char*)&nonce, sizeof(nonce));
@@ -6432,7 +6466,7 @@ bool SendMessages(CNode* pto, CConnman& connman)
if (pindexBestHeader == NULL)
pindexBestHeader = chainActive.Tip();
bool fFetch = state.fPreferredDownload || (nPreferredDownload == 0 && !pto->fClient && !pto->fOneShot); // Download if this is a nice peer, or we have no nice peers and this one might do.
- if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex) {
+ if (!state.fSyncStarted && !pto->fClient && !pto->fDisconnect && !fImporting && !fReindex) {
// Only actively request headers from a single peer, unless we're close to today.
if ((nSyncStarted == 0 && fFetch) || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) {
state.fSyncStarted = true;
@@ -6536,8 +6570,8 @@ bool SendMessages(CNode* pto, CConnman& connman)
//TODO: Shouldn't need to reload block from disk, but requires refactor
CBlock block;
assert(ReadBlockFromDisk(block, pBestIndex, consensusParams));
- CBlockHeaderAndShortTxIDs cmpctblock(block);
- pto->PushMessageWithFlag(SERIALIZE_TRANSACTION_NO_WITNESS, NetMsgType::CMPCTBLOCK, cmpctblock);
+ CBlockHeaderAndShortTxIDs cmpctblock(block, state.fWantsCmpctWitness);
+ pto->PushMessageWithFlag(state.fWantsCmpctWitness ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS, NetMsgType::CMPCTBLOCK, cmpctblock);
state.pindexBestHeaderSent = pBestIndex;
} else if (state.fPreferHeaders) {
if (vHeaders.size() > 1) {
diff --git a/src/net.cpp b/src/net.cpp
index 770e2d2959..19dd040997 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -629,6 +629,7 @@ void CNode::copyStats(CNodeStats &stats)
{
stats.nodeid = this->GetId();
X(nServices);
+ X(addr);
X(fRelayTxes);
X(nLastSend);
X(nLastRecv);
diff --git a/src/net.h b/src/net.h
index d0b2773623..67f0abe4be 100644
--- a/src/net.h
+++ b/src/net.h
@@ -505,6 +505,7 @@ public:
double dPingWait;
double dPingMin;
std::string addrLocal;
+ CAddress addr;
};
diff --git a/src/prevector.h b/src/prevector.h
index a0e1e140b4..25bce522dc 100644
--- a/src/prevector.h
+++ b/src/prevector.h
@@ -475,6 +475,14 @@ public:
return ((size_t)(sizeof(T))) * _union.capacity;
}
}
+
+ value_type* data() {
+ return item_ptr(0);
+ }
+
+ const value_type* data() const {
+ return item_ptr(0);
+ }
};
#pragma pack(pop)
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index dd022ee762..af767aa6c6 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -74,6 +74,8 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
#endif
;
+/** Display name for default wallet name. Uses tilde to avoid name
+ * collisions in the future with additional wallets */
const QString BitcoinGUI::DEFAULT_WALLET = "~Default";
BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 6d19b3d122..87704c641d 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -256,7 +256,7 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, const CB
int64_t& nLastUpdateNotification = fHeader ? nLastHeaderTipUpdateNotification : nLastBlockTipUpdateNotification;
// if we are in-sync, update the UI regardless of last update time
- if (fHeader || !initialSync || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) {
+ if (!initialSync || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) {
//pass a async signal to the UI thread
QMetaObject::invokeMethod(clientmodel, "numBlocksChanged", Qt::QueuedConnection,
Q_ARG(int, pIndex->nHeight),
diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp
index 2de2dde16a..5caade7d38 100644
--- a/src/qt/modaloverlay.cpp
+++ b/src/qt/modaloverlay.cpp
@@ -13,7 +13,8 @@
ModalOverlay::ModalOverlay(QWidget *parent) :
QWidget(parent),
ui(new Ui::ModalOverlay),
-bestBlockHeight(0),
+bestHeaderHeight(0),
+bestHeaderDate(QDateTime()),
layerIsVisible(false),
userClosed(false)
{
@@ -65,14 +66,9 @@ bool ModalOverlay::event(QEvent* ev) {
void ModalOverlay::setKnownBestHeight(int count, const QDateTime& blockDate)
{
-
- /* only update the blockheight if the headerschain-tip is not older then 30 days */
- int64_t now = QDateTime::currentDateTime().toTime_t();
- int64_t btime = blockDate.toTime_t();
- if (btime+3600*24*30 > now)
- {
- if (count > bestBlockHeight)
- bestBlockHeight = count;
+ if (count > bestHeaderHeight) {
+ bestHeaderHeight = count;
+ bestHeaderDate = blockDate;
}
}
@@ -125,11 +121,21 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri
ui->percentageProgress->setText(QString::number(nVerificationProgress*100, 'f', 2)+"%");
ui->progressBar->setValue(nVerificationProgress*100);
+ if (!bestHeaderDate.isValid())
+ // not syncing
+ return;
+
+ // estimate the number of headers left based on nPowTargetSpacing
+ // and check if the gui is not aware of the the best header (happens rarely)
+ int estimateNumHeadersLeft = bestHeaderDate.secsTo(currentDate) / 600;
+ bool hasBestHeader = bestHeaderHeight >= count;
+
// show remaining number of blocks
- if (bestBlockHeight > 0)
- ui->numberOfBlocksLeft->setText(QString::number(bestBlockHeight-count));
- else
+ if (estimateNumHeadersLeft < 24 && hasBestHeader) {
+ ui->numberOfBlocksLeft->setText(QString::number(bestHeaderHeight - count));
+ } else {
ui->expectedTimeLeft->setText(tr("Unknown. Syncing Headers..."));
+ }
}
void ModalOverlay::showHide(bool hide, bool userRequested)
diff --git a/src/qt/modaloverlay.h b/src/qt/modaloverlay.h
index 670c9e58ab..66c0aa78cf 100644
--- a/src/qt/modaloverlay.h
+++ b/src/qt/modaloverlay.h
@@ -35,7 +35,8 @@ protected:
private:
Ui::ModalOverlay *ui;
- int bestBlockHeight; //best known height (based on the headers)
+ int bestHeaderHeight; //best known height (based on the headers)
+ QDateTime bestHeaderDate;
QVector<QPair<qint64, double> > blockProcessTime;
bool layerIsVisible;
bool userClosed;
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index ace9f1ceaa..b6ed75535c 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -981,20 +981,21 @@ void RPCConsole::banSelectedNode(int bantime)
if (!clientModel || !g_connman)
return;
- // Get currently selected peer address
- QString strNode = GUIUtil::getEntryData(ui->peerWidget, 0, PeerTableModel::Address).toString();
- // Find possible nodes, ban it and clear the selected node
- std::string nStr = strNode.toStdString();
- std::string addr;
- int port = 0;
- SplitHostPort(nStr, port, addr);
+ if(cachedNodeid == -1)
+ return;
- CNetAddr resolved;
- if(!LookupHost(addr.c_str(), resolved, false))
+ // Get currently selected peer address
+ int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(cachedNodeid);
+ if(detailNodeRow < 0)
return;
- g_connman->Ban(resolved, BanReasonManuallyAdded, bantime);
- clearSelectedNode();
- clientModel->getBanTableModel()->refresh();
+
+ // Find possible nodes, ban it and clear the selected node
+ const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(detailNodeRow);
+ if(stats) {
+ g_connman->Ban(stats->nodeStats.addr, BanReasonManuallyAdded, bantime);
+ clearSelectedNode();
+ clientModel->getBanTableModel()->refresh();
+ }
}
void RPCConsole::unbanSelectedNode()
diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h
index 00c2f56363..7bc6412910 100644
--- a/src/qt/walletframe.h
+++ b/src/qt/walletframe.h
@@ -19,6 +19,13 @@ QT_BEGIN_NAMESPACE
class QStackedWidget;
QT_END_NAMESPACE
+/**
+ * A container for embedding all wallet-related
+ * controls into BitcoinGUI. The purpose of this class is to allow future
+ * refinements of the wallet controls with minimal need for further
+ * modifications to BitcoinGUI, thus greatly simplifying merges while
+ * reducing the risk of breaking top-level stuff.
+ */
class WalletFrame : public QFrame
{
Q_OBJECT
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 41d862934a..1e04fcc01c 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1038,7 +1038,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
" \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n"
" \"chainwork\": \"xxxx\" (string) total amount of work in active chain, in hexadecimal\n"
" \"pruned\": xx, (boolean) if the blocks are subject to pruning\n"
- " \"pruneheight\": xxxxxx, (numeric) heighest block available\n"
+ " \"pruneheight\": xxxxxx, (numeric) lowest-height complete block stored\n"
" \"softforks\": [ (array) status of softforks in progress\n"
" {\n"
" \"id\": \"xxxx\", (string) name of softfork\n"
diff --git a/src/script/bitcoinconsensus.h b/src/script/bitcoinconsensus.h
index f73a8e30bc..1d2d5c23e4 100644
--- a/src/script/bitcoinconsensus.h
+++ b/src/script/bitcoinconsensus.h
@@ -1,5 +1,5 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2015 The Bitcoin Core developers
+// Copyright (c) 2009-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -50,6 +50,7 @@ enum
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NONE = 0,
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH = (1U << 0), // evaluate P2SH (BIP16) subscripts
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG = (1U << 2), // enforce strict DER (BIP66) compliance
+ bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NULLDUMMY = (1U << 4), // enforce NULLDUMMY (BIP147)
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9), // enable CHECKLOCKTIMEVERIFY (BIP65)
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKSEQUENCEVERIFY = (1U << 10), // enable CHECKSEQUENCEVERIFY (BIP112)
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS = (1U << 11), // enable WITNESS (BIP141)
diff --git a/src/serialize.h b/src/serialize.h
index 04ab9aa2e7..1f51da82ff 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -44,33 +44,32 @@ inline T* NCONST_PTR(const T* val)
return const_cast<T*>(val);
}
-/**
- * Get begin pointer of vector (non-const version).
- * @note These functions avoid the undefined case of indexing into an empty
- * vector, as well as that of indexing after the end of the vector.
+/**
+ * Important: Do not use the following functions in new code, but use v.data()
+ * and v.data() + v.size() respectively directly. They were once introduced to
+ * have a compatible, safe way to get the begin and end pointer of a vector.
+ * However with C++11 the language has built-in functionality for this and it's
+ * more readable to just use that.
*/
template <typename V>
inline typename V::value_type* begin_ptr(V& v)
{
- return v.empty() ? NULL : &v[0];
+ return v.data();
}
-/** Get begin pointer of vector (const version) */
template <typename V>
inline const typename V::value_type* begin_ptr(const V& v)
{
- return v.empty() ? NULL : &v[0];
+ return v.data();
}
-/** Get end pointer of vector (non-const version) */
template <typename V>
inline typename V::value_type* end_ptr(V& v)
{
- return v.empty() ? NULL : (&v[0] + v.size());
+ return v.data() + v.size();
}
-/** Get end pointer of vector (const version) */
template <typename V>
inline const typename V::value_type* end_ptr(const V& v)
{
- return v.empty() ? NULL : (&v[0] + v.size());
+ return v.data() + v.size();
}
/*
diff --git a/src/test/bctest.py b/src/test/bctest.py
index 39a27fcd0c..d801415c70 100644
--- a/src/test/bctest.py
+++ b/src/test/bctest.py
@@ -45,13 +45,17 @@ def bctest(testDir, testObj, exeext):
print("Return code mismatch for " + outputFn)
sys.exit(1)
-def bctester(testDir, input_basename, buildenv):
+def bctester(testDir, input_basename, buildenv, verbose = False):
input_filename = testDir + "/" + input_basename
raw_data = open(input_filename).read()
input_data = json.loads(raw_data)
for testObj in input_data:
+ if verbose and "description" in testObj:
+ print ("Testing: " + testObj["description"])
bctest(testDir, testObj, buildenv.exeext)
+ if verbose and "description" in testObj:
+ print ("PASS")
sys.exit(0)
diff --git a/src/test/bitcoin-util-test.py b/src/test/bitcoin-util-test.py
index 225b3324e9..3099506d6d 100755
--- a/src/test/bitcoin-util-test.py
+++ b/src/test/bitcoin-util-test.py
@@ -19,11 +19,14 @@ test/bitcoin-util-test.py --src=[srcdir]
if __name__ == '__main__':
+ verbose = False
try:
srcdir = os.environ["srcdir"]
except:
parser = argparse.ArgumentParser(description=help_text)
parser.add_argument('-s', '--srcdir')
+ parser.add_argument('-v', '--verbose', action='store_true')
args = parser.parse_args()
srcdir = args.srcdir
- bctest.bctester(srcdir + "/test/data", "bitcoin-util-test.json", buildenv)
+ verbose = args.verbose
+ bctest.bctester(srcdir + "/test/data", "bitcoin-util-test.json", buildenv, verbose = verbose)
diff --git a/src/test/blockencodings_tests.cpp b/src/test/blockencodings_tests.cpp
index d2392cfb22..7530b013bd 100644
--- a/src/test/blockencodings_tests.cpp
+++ b/src/test/blockencodings_tests.cpp
@@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(SimpleRoundTripTest)
// Do a simple ShortTxIDs RT
{
- CBlockHeaderAndShortTxIDs shortIDs(block);
+ CBlockHeaderAndShortTxIDs shortIDs(block, true);
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
stream << shortIDs;
@@ -116,7 +116,7 @@ public:
stream >> *this;
}
TestHeaderAndShortIDs(const CBlock& block) :
- TestHeaderAndShortIDs(CBlockHeaderAndShortTxIDs(block)) {}
+ TestHeaderAndShortIDs(CBlockHeaderAndShortTxIDs(block, true)) {}
uint64_t GetShortID(const uint256& txhash) const {
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
@@ -267,7 +267,7 @@ BOOST_AUTO_TEST_CASE(EmptyBlockRoundTripTest)
// Test simple header round-trip with only coinbase
{
- CBlockHeaderAndShortTxIDs shortIDs(block);
+ CBlockHeaderAndShortTxIDs shortIDs(block, false);
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
stream << shortIDs;
diff --git a/src/test/data/bitcoin-util-test.json b/src/test/data/bitcoin-util-test.json
index 9df61a7e79..de95044597 100644
--- a/src/test/data/bitcoin-util-test.json
+++ b/src/test/data/bitcoin-util-test.json
@@ -1,61 +1,73 @@
[
{ "exec": "./bitcoin-tx",
"args": ["-create"],
- "output_cmp": "blanktx.hex"
+ "output_cmp": "blanktx.hex",
+ "description": "Creates a blank transaction"
},
{ "exec": "./bitcoin-tx",
"args": ["-json","-create"],
- "output_cmp": "blanktx.json"
+ "output_cmp": "blanktx.json",
+ "description": "Creates a blank transaction (output in json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-"],
"input": "blanktx.hex",
- "output_cmp": "blanktx.hex"
+ "output_cmp": "blanktx.hex",
+ "description": "Creates a blank transaction when nothing is piped into bitcoin-tx"
},
{ "exec": "./bitcoin-tx",
"args": ["-json","-"],
"input": "blanktx.hex",
- "output_cmp": "blanktx.json"
+ "output_cmp": "blanktx.json",
+ "description": "Creates a blank transaction when nothing is piped into bitcoin-tx (output in json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-", "delin=1"],
"input": "tx394b54bb.hex",
- "output_cmp": "tt-delin1-out.hex"
+ "output_cmp": "tt-delin1-out.hex",
+ "description": "Deletes a single input from a transaction"
},
{ "exec": "./bitcoin-tx",
"args": ["-json", "-", "delin=1"],
"input": "tx394b54bb.hex",
- "output_cmp": "tt-delin1-out.json"
+ "output_cmp": "tt-delin1-out.json",
+ "description": "Deletes a single input from a transaction (output in json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-", "delin=31"],
"input": "tx394b54bb.hex",
- "return_code": 1
+ "return_code": 1,
+ "description": "Attempts to delete an input with a bad index from a transaction. Expected to fail."
},
{ "exec": "./bitcoin-tx",
"args": ["-", "delout=1"],
"input": "tx394b54bb.hex",
- "output_cmp": "tt-delout1-out.hex"
+ "output_cmp": "tt-delout1-out.hex",
+ "description": "Deletes a single output from a transaction"
},
{ "exec": "./bitcoin-tx",
"args": ["-json", "-", "delout=1"],
"input": "tx394b54bb.hex",
- "output_cmp": "tt-delout1-out.json"
+ "output_cmp": "tt-delout1-out.json",
+ "description": "Deletes a single output from a transaction (output in json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-", "delout=2"],
"input": "tx394b54bb.hex",
- "return_code": 1
+ "return_code": 1,
+ "description": "Attempts to delete an output with a bad index from a transaction. Expected to fail."
},
{ "exec": "./bitcoin-tx",
"args": ["-", "locktime=317000"],
"input": "tx394b54bb.hex",
- "output_cmp": "tt-locktime317000-out.hex"
+ "output_cmp": "tt-locktime317000-out.hex",
+ "description": "Adds an nlocktime to a transaction"
},
{ "exec": "./bitcoin-tx",
"args": ["-json", "-", "locktime=317000"],
"input": "tx394b54bb.hex",
- "output_cmp": "tt-locktime317000-out.json"
+ "output_cmp": "tt-locktime317000-out.json",
+ "description": "Adds an nlocktime to a transaction (output in json)"
},
{ "exec": "./bitcoin-tx",
"args":
@@ -65,7 +77,8 @@
"in=22a6f904655d53ae2ff70e701a0bbd90aa3975c0f40bfc6cc996a9049e31cdfc:1",
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o",
"outaddr=4:1P8yWvZW8jVihP1bzHeqfE4aoXNX8AVa46"],
- "output_cmp": "txcreate1.hex"
+ "output_cmp": "txcreate1.hex",
+ "description": "Creates a new transaction with three inputs and two outputs"
},
{ "exec": "./bitcoin-tx",
"args":
@@ -76,15 +89,18 @@
"in=22a6f904655d53ae2ff70e701a0bbd90aa3975c0f40bfc6cc996a9049e31cdfc:1",
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o",
"outaddr=4:1P8yWvZW8jVihP1bzHeqfE4aoXNX8AVa46"],
- "output_cmp": "txcreate1.json"
+ "output_cmp": "txcreate1.json",
+ "description": "Creates a new transaction with three inputs and two outputs (output in json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-create", "outscript=0:"],
- "output_cmp": "txcreate2.hex"
+ "output_cmp": "txcreate2.hex",
+ "description": "Creates a new transaction with a single empty output script"
},
{ "exec": "./bitcoin-tx",
"args": ["-json", "-create", "outscript=0:"],
- "output_cmp": "txcreate2.json"
+ "output_cmp": "txcreate2.json",
+ "description": "Creates a new transaction with a single empty output script (output in json)"
},
{ "exec": "./bitcoin-tx",
"args":
@@ -94,7 +110,8 @@
"set=prevtxs:[{\"txid\":\"4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485\",\"vout\":0,\"scriptPubKey\":\"76a91491b24bf9f5288532960ac687abb035127b1d28a588ac\"}]",
"sign=ALL",
"outaddr=0.001:193P6LtvS4nCnkDvM9uXn1gsSRqh4aDAz7"],
- "output_cmp": "txcreatesign.hex"
+ "output_cmp": "txcreatesign.hex",
+ "description": "Creates a new transaction with a single input and a single output, and then signs the transaction"
},
{ "exec": "./bitcoin-tx",
"args":
@@ -105,21 +122,24 @@
"set=prevtxs:[{\"txid\":\"4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485\",\"vout\":0,\"scriptPubKey\":\"76a91491b24bf9f5288532960ac687abb035127b1d28a588ac\"}]",
"sign=ALL",
"outaddr=0.001:193P6LtvS4nCnkDvM9uXn1gsSRqh4aDAz7"],
- "output_cmp": "txcreatesign.json"
+ "output_cmp": "txcreatesign.json",
+ "description": "Creates a new transaction with a single input and a single output, and then signs the transaction (output in json)"
},
{ "exec": "./bitcoin-tx",
"args":
["-create",
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
"outdata=4:badhexdata"],
- "return_code": 1
+ "return_code": 1,
+ "description": "Attempts to create a new transaction with one input and an output with malformed hex data. Expected to fail"
},
{ "exec": "./bitcoin-tx",
"args":
["-create",
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
"outdata=badhexdata"],
- "return_code": 1
+ "return_code": 1,
+ "description": "Attempts to create a new transaction with one input and an output with no value and malformed hex data. Expected to fail"
},
{ "exec": "./bitcoin-tx",
"args":
@@ -127,7 +147,8 @@
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o",
"outdata=4:54686973204f505f52455455524e207472616e73616374696f6e206f7574707574207761732063726561746564206279206d6f646966696564206372656174657261777472616e73616374696f6e2e"],
- "output_cmp": "txcreatedata1.hex"
+ "output_cmp": "txcreatedata1.hex",
+ "description": "Creates a new transaction with one input, one address output and one data output"
},
{ "exec": "./bitcoin-tx",
"args":
@@ -136,7 +157,8 @@
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o",
"outdata=4:54686973204f505f52455455524e207472616e73616374696f6e206f7574707574207761732063726561746564206279206d6f646966696564206372656174657261777472616e73616374696f6e2e"],
- "output_cmp": "txcreatedata1.json"
+ "output_cmp": "txcreatedata1.json",
+ "description": "Creates a new transaction with one input, one address output and one data output (output in json)"
},
{ "exec": "./bitcoin-tx",
"args":
@@ -144,7 +166,8 @@
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o",
"outdata=54686973204f505f52455455524e207472616e73616374696f6e206f7574707574207761732063726561746564206279206d6f646966696564206372656174657261777472616e73616374696f6e2e"],
- "output_cmp": "txcreatedata2.hex"
+ "output_cmp": "txcreatedata2.hex",
+ "description": "Creates a new transaction with one input, one address output and one data (zero value) output"
},
{ "exec": "./bitcoin-tx",
"args":
@@ -153,14 +176,16 @@
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o",
"outdata=54686973204f505f52455455524e207472616e73616374696f6e206f7574707574207761732063726561746564206279206d6f646966696564206372656174657261777472616e73616374696f6e2e"],
- "output_cmp": "txcreatedata2.json"
+ "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": "./bitcoin-tx",
"args":
["-create",
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:4294967293",
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o"],
- "output_cmp": "txcreatedata_seq0.hex"
+ "output_cmp": "txcreatedata_seq0.hex",
+ "description": "Creates a new transaction with one input with sequence number and one address output"
},
{ "exec": "./bitcoin-tx",
"args":
@@ -168,19 +193,22 @@
"-create",
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:4294967293",
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o"],
- "output_cmp": "txcreatedata_seq0.json"
+ "output_cmp": "txcreatedata_seq0.json",
+ "description": "Creates a new transaction with one input with sequence number and one address output (output in json)"
},
{ "exec": "./bitcoin-tx",
"args":
["01000000011f5c38dfcf6f1a5f5a87c416076d392c87e6d41970d5ad5e477a02d66bde97580000000000fdffffff0180a81201000000001976a9141fc11f39be1729bf973a7ab6a615ca4729d6457488ac00000000",
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:1"],
- "output_cmp": "txcreatedata_seq1.hex"
+ "output_cmp": "txcreatedata_seq1.hex",
+ "description": "Adds a new input with sequence number to a transaction"
},
{ "exec": "./bitcoin-tx",
"args":
["-json",
"01000000011f5c38dfcf6f1a5f5a87c416076d392c87e6d41970d5ad5e477a02d66bde97580000000000fdffffff0180a81201000000001976a9141fc11f39be1729bf973a7ab6a615ca4729d6457488ac00000000",
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:1"],
- "output_cmp": "txcreatedata_seq1.json"
+ "output_cmp": "txcreatedata_seq1.json",
+ "description": "Adds a new input with sequence number to a transaction (output in json)"
}
]
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 3586123d3e..15fa6fbca3 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -444,7 +444,7 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry,
totalTxSize += entry.GetTxSize();
minerPolicyEstimator->processTransaction(entry, fCurrentEstimate);
- vTxHashes.emplace_back(hash, newit);
+ vTxHashes.emplace_back(tx.GetWitnessHash(), newit);
newit->vTxHashesIdx = vTxHashes.size() - 1;
return true;
diff --git a/src/txmempool.h b/src/txmempool.h
index 6f67dd91d6..941644b2b2 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -465,7 +465,7 @@ public:
indexed_transaction_set mapTx;
typedef indexed_transaction_set::nth_index<0>::type::iterator txiter;
- std::vector<std::pair<uint256, txiter> > vTxHashes; //!< All tx hashes/entries in mapTx, in random order
+ std::vector<std::pair<uint256, txiter> > vTxHashes; //!< All tx witness hashes/entries in mapTx, in random order
struct CompareIteratorByHash {
bool operator()(const txiter &a, const txiter &b) const {