Merge #10484: 0.14 Backports
1847642 [Wallet] unset change position when there is no change on exact match (Gregory Sanders) ae479bc build: fix bitcoin-config.h regeneration after touching build files (Cory Fields) 3d395d6 build: remove wonky auto top-level convenience targets (Cory Fields) 4bc99c3 Add missing <atomic> header in clientmodel.h (Jonas Schnelli) 222f377 Set both time/height header caches at the same time (Jonas Schnelli) 7da1337 Declare headers height/time cache mutable, re-set the methods const (Jonas Schnelli) 9ac40e8 Update the remaining blocks left in modaloverlay at init. (Jonas Schnelli) 1e936d7 Reduce cs_main locks during modal overlay by adding an atomic cache (Jonas Schnelli) 0aee4a1 Check interruptNet during dnsseed lookups (Matt Corallo)
This commit is contained in:
commit
ff3f9a807d
@ -76,9 +76,6 @@ $(BITCOIN_WIN_INSTALLER): all-recursive
|
||||
echo error: could not build $@
|
||||
@echo built $@
|
||||
|
||||
$(if $(findstring src/,$(MAKECMDGOALS)),$(MAKECMDGOALS), none): FORCE
|
||||
$(MAKE) -C src $(patsubst src/%,%,$@)
|
||||
|
||||
$(OSX_APP)/Contents/PkgInfo:
|
||||
$(MKDIR_P) $(@D)
|
||||
@echo "APPL????" > $@
|
||||
|
||||
@ -54,6 +54,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
self.nodes[0].generate(121)
|
||||
self.sync_all()
|
||||
|
||||
# ensure that setting changePosition in fundraw with an exact match is handled properly
|
||||
rawmatch = self.nodes[2].createrawtransaction([], {self.nodes[2].getnewaddress():50})
|
||||
rawmatch = self.nodes[2].fundrawtransaction(rawmatch, {"changePosition":1, "subtractFeeFromOutputs":[0]})
|
||||
assert_equal(rawmatch["changepos"], -1)
|
||||
|
||||
watchonly_address = self.nodes[0].getnewaddress()
|
||||
watchonly_pubkey = self.nodes[0].validateaddress(watchonly_address)["pubkey"]
|
||||
watchonly_amount = Decimal(200)
|
||||
|
||||
@ -457,6 +457,14 @@ DISTCLEANFILES = obj/build.h
|
||||
|
||||
EXTRA_DIST = $(CTAES_DIST)
|
||||
|
||||
|
||||
config/bitcoin-config.h: config/stamp-h1
|
||||
@$(MAKE) -C $(top_builddir) $(subdir)/$(@)
|
||||
config/stamp-h1: $(top_srcdir)/$(subdir)/config/bitcoin-config.h.in $(top_builddir)/config.status
|
||||
$(AM_V_at)$(MAKE) -C $(top_builddir) $(subdir)/$(@)
|
||||
$(top_srcdir)/$(subdir)/config/bitcoin-config.h.in: $(am__configure_deps)
|
||||
$(AM_V_at)$(MAKE) -C $(top_srcdir) $(subdir)/config/bitcoin-config.h.in
|
||||
|
||||
clean-local:
|
||||
-$(MAKE) -C secp256k1 clean
|
||||
-$(MAKE) -C univalue clean
|
||||
|
||||
@ -1579,6 +1579,9 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
LogPrintf("Loading addresses from DNS seeds (could take a while)\n");
|
||||
|
||||
BOOST_FOREACH(const CDNSSeedData &seed, vSeeds) {
|
||||
if (interruptNet) {
|
||||
return;
|
||||
}
|
||||
if (HaveNameProxy()) {
|
||||
AddOneShot(seed.host);
|
||||
} else {
|
||||
@ -1596,6 +1599,9 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
found++;
|
||||
}
|
||||
}
|
||||
if (interruptNet) {
|
||||
return;
|
||||
}
|
||||
// TODO: The seed name resolve may fail, yielding an IP of [::], which results in
|
||||
// addrman assigning the same source to results from different seeds.
|
||||
// This should switch to a hard-coded stable dummy IP for each seed name, so that the
|
||||
|
||||
@ -478,6 +478,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
|
||||
connect(_clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
|
||||
connect(_clientModel, SIGNAL(networkActiveChanged(bool)), this, SLOT(setNetworkActive(bool)));
|
||||
|
||||
modalOverlay->setKnownBestHeight(_clientModel->getHeaderTipHeight(), QDateTime::fromTime_t(_clientModel->getHeaderTipTime()));
|
||||
setNumBlocks(_clientModel->getNumBlocks(), _clientModel->getLastBlockDate(), _clientModel->getVerificationProgress(NULL), false);
|
||||
connect(_clientModel, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(setNumBlocks(int,QDateTime,double,bool)));
|
||||
|
||||
@ -505,8 +506,6 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
|
||||
// initialize the disable state of the tray icon with the current value in the model.
|
||||
setTrayIconVisible(optionsModel->getHideTrayIcon());
|
||||
}
|
||||
|
||||
modalOverlay->setKnownBestHeight(clientModel->getHeaderTipHeight(), QDateTime::fromTime_t(clientModel->getHeaderTipTime()));
|
||||
} else {
|
||||
// Disable possibility to show main window via action
|
||||
toggleHideAction->setEnabled(false);
|
||||
|
||||
@ -36,6 +36,8 @@ ClientModel::ClientModel(OptionsModel *_optionsModel, QObject *parent) :
|
||||
banTableModel(0),
|
||||
pollTimer(0)
|
||||
{
|
||||
cachedBestHeaderHeight = -1;
|
||||
cachedBestHeaderTime = -1;
|
||||
peerTableModel = new PeerTableModel(this);
|
||||
banTableModel = new BanTableModel(this);
|
||||
pollTimer = new QTimer(this);
|
||||
@ -74,18 +76,28 @@ int ClientModel::getNumBlocks() const
|
||||
|
||||
int ClientModel::getHeaderTipHeight() const
|
||||
{
|
||||
LOCK(cs_main);
|
||||
if (!pindexBestHeader)
|
||||
return 0;
|
||||
return pindexBestHeader->nHeight;
|
||||
if (cachedBestHeaderHeight == -1) {
|
||||
// make sure we initially populate the cache via a cs_main lock
|
||||
// otherwise we need to wait for a tip update
|
||||
LOCK(cs_main);
|
||||
if (pindexBestHeader) {
|
||||
cachedBestHeaderHeight = pindexBestHeader->nHeight;
|
||||
cachedBestHeaderTime = pindexBestHeader->GetBlockTime();
|
||||
}
|
||||
}
|
||||
return cachedBestHeaderHeight;
|
||||
}
|
||||
|
||||
int64_t ClientModel::getHeaderTipTime() const
|
||||
{
|
||||
LOCK(cs_main);
|
||||
if (!pindexBestHeader)
|
||||
return 0;
|
||||
return pindexBestHeader->GetBlockTime();
|
||||
if (cachedBestHeaderTime == -1) {
|
||||
LOCK(cs_main);
|
||||
if (pindexBestHeader) {
|
||||
cachedBestHeaderHeight = pindexBestHeader->nHeight;
|
||||
cachedBestHeaderTime = pindexBestHeader->GetBlockTime();
|
||||
}
|
||||
}
|
||||
return cachedBestHeaderTime;
|
||||
}
|
||||
|
||||
quint64 ClientModel::getTotalBytesRecv() const
|
||||
@ -283,6 +295,11 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, const CB
|
||||
|
||||
int64_t& nLastUpdateNotification = fHeader ? nLastHeaderTipUpdateNotification : nLastBlockTipUpdateNotification;
|
||||
|
||||
if (fHeader) {
|
||||
// cache best headers time and height to reduce future cs_main locks
|
||||
clientmodel->cachedBestHeaderHeight = pIndex->nHeight;
|
||||
clientmodel->cachedBestHeaderTime = pIndex->GetBlockTime();
|
||||
}
|
||||
// if we are in-sync, update the UI regardless of last update time
|
||||
if (!initialSync || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) {
|
||||
//pass a async signal to the UI thread
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
class AddressTableModel;
|
||||
class BanTableModel;
|
||||
class OptionsModel;
|
||||
@ -81,6 +83,10 @@ public:
|
||||
QString formatClientStartupTime() const;
|
||||
QString dataDir() const;
|
||||
|
||||
// caches for the best header
|
||||
mutable std::atomic<int> cachedBestHeaderHeight;
|
||||
mutable std::atomic<int64_t> cachedBestHeaderTime;
|
||||
|
||||
private:
|
||||
OptionsModel *optionsModel;
|
||||
PeerTableModel *peerTableModel;
|
||||
|
||||
@ -2587,9 +2587,10 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
vector<CTxOut>::iterator position = txNew.vout.begin()+nChangePosInOut;
|
||||
txNew.vout.insert(position, newTxOut);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
reservekey.ReturnKey();
|
||||
nChangePosInOut = -1;
|
||||
}
|
||||
|
||||
// Fill vin
|
||||
//
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user