|
|
@ -72,6 +72,7 @@ const string strMessageMagic = "Bitcoin Signed Message:\n"; |
|
|
|
|
|
|
|
|
|
|
|
// Internal stuff
|
|
|
|
// Internal stuff
|
|
|
|
namespace { |
|
|
|
namespace { |
|
|
|
|
|
|
|
|
|
|
|
struct CBlockIndexWorkComparator |
|
|
|
struct CBlockIndexWorkComparator |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool operator()(CBlockIndex *pa, CBlockIndex *pb) { |
|
|
|
bool operator()(CBlockIndex *pa, CBlockIndex *pb) { |
|
|
@ -120,7 +121,8 @@ namespace { |
|
|
|
}; |
|
|
|
}; |
|
|
|
map<uint256, pair<NodeId, list<QueuedBlock>::iterator> > mapBlocksInFlight; |
|
|
|
map<uint256, pair<NodeId, list<QueuedBlock>::iterator> > mapBlocksInFlight; |
|
|
|
map<uint256, pair<NodeId, list<uint256>::iterator> > mapBlocksToDownload; |
|
|
|
map<uint256, pair<NodeId, list<uint256>::iterator> > mapBlocksToDownload; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} // anon namespace
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -130,6 +132,7 @@ namespace { |
|
|
|
// These functions dispatch to one or all registered wallets
|
|
|
|
// These functions dispatch to one or all registered wallets
|
|
|
|
|
|
|
|
|
|
|
|
namespace { |
|
|
|
namespace { |
|
|
|
|
|
|
|
|
|
|
|
struct CMainSignals { |
|
|
|
struct CMainSignals { |
|
|
|
// Notifies listeners of updated transaction data (transaction, and optionally the block it is found in.
|
|
|
|
// Notifies listeners of updated transaction data (transaction, and optionally the block it is found in.
|
|
|
|
boost::signals2::signal<void (const CTransaction &, const CBlock *)> SyncTransaction; |
|
|
|
boost::signals2::signal<void (const CTransaction &, const CBlock *)> SyncTransaction; |
|
|
@ -144,7 +147,8 @@ struct CMainSignals { |
|
|
|
// Tells listeners to broadcast their data.
|
|
|
|
// Tells listeners to broadcast their data.
|
|
|
|
boost::signals2::signal<void ()> Broadcast; |
|
|
|
boost::signals2::signal<void ()> Broadcast; |
|
|
|
} g_signals; |
|
|
|
} g_signals; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} // anon namespace
|
|
|
|
|
|
|
|
|
|
|
|
void RegisterWallet(CWalletInterface* pwalletIn) { |
|
|
|
void RegisterWallet(CWalletInterface* pwalletIn) { |
|
|
|
g_signals.SyncTransaction.connect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, _1, _2)); |
|
|
|
g_signals.SyncTransaction.connect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, _1, _2)); |
|
|
@ -274,7 +278,6 @@ void MarkBlockAsReceived(const uint256 &hash, NodeId nodeFrom = -1) { |
|
|
|
state->nLastBlockReceive = GetTimeMicros(); |
|
|
|
state->nLastBlockReceive = GetTimeMicros(); |
|
|
|
mapBlocksInFlight.erase(itInFlight); |
|
|
|
mapBlocksInFlight.erase(itInFlight); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Requires cs_main.
|
|
|
|
// Requires cs_main.
|
|
|
@ -310,7 +313,7 @@ void MarkBlockAsInFlight(NodeId nodeid, const uint256 &hash) { |
|
|
|
mapBlocksInFlight[hash] = std::make_pair(nodeid, it); |
|
|
|
mapBlocksInFlight[hash] = std::make_pair(nodeid, it); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} // anon namespace
|
|
|
|
|
|
|
|
|
|
|
|
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) { |
|
|
|
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) { |
|
|
|
LOCK(cs_main); |
|
|
|
LOCK(cs_main); |
|
|
|