Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/chain.cpp
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | class LockImpl : public Chain::Lock, public UniqueLock<RecursiveMutex> { | ||||
height->reset(); | height->reset(); | ||||
} | } | ||||
} | } | ||||
if (fork) { | if (fork) { | ||||
return fork->nHeight; | return fork->nHeight; | ||||
} | } | ||||
return nullopt; | return nullopt; | ||||
} | } | ||||
bool isPotentialTip(const BlockHash &hash) override { | |||||
if (::ChainActive().Tip()->GetBlockHash() == hash) { | |||||
return true; | |||||
} | |||||
CBlockIndex *block = LookupBlockIndex(hash); | |||||
return block && block->GetAncestor(::ChainActive().Height()) == | |||||
::ChainActive().Tip(); | |||||
} | |||||
CBlockLocator getTipLocator() override { | CBlockLocator getTipLocator() override { | ||||
return ::ChainActive().GetLocator(); | return ::ChainActive().GetLocator(); | ||||
} | } | ||||
Optional<int> findLocatorFork(const CBlockLocator &locator) override { | Optional<int> findLocatorFork(const CBlockLocator &locator) override { | ||||
LockAnnotation lock(::cs_main); | LockAnnotation lock(::cs_main); | ||||
if (CBlockIndex *fork = | if (CBlockIndex *fork = | ||||
FindForkInGlobalIndex(::ChainActive(), locator)) { | FindForkInGlobalIndex(::ChainActive(), locator)) { | ||||
return fork->nHeight; | return fork->nHeight; | ||||
▲ Show 20 Lines • Show All 215 Lines • ▼ Show 20 Lines | public: | ||||
bool resume_possible) override { | bool resume_possible) override { | ||||
::uiInterface.ShowProgress(title, progress, resume_possible); | ::uiInterface.ShowProgress(title, progress, resume_possible); | ||||
} | } | ||||
std::unique_ptr<Handler> | std::unique_ptr<Handler> | ||||
handleNotifications(Notifications ¬ifications) override { | handleNotifications(Notifications ¬ifications) override { | ||||
return std::make_unique<NotificationsHandlerImpl>(*this, | return std::make_unique<NotificationsHandlerImpl>(*this, | ||||
notifications); | notifications); | ||||
} | } | ||||
void waitForNotifications() override { | void waitForNotificationsIfNewBlocksConnected( | ||||
const BlockHash &old_tip) override { | |||||
if (!old_tip.IsNull()) { | |||||
LOCK(::cs_main); | |||||
if (old_tip == ::ChainActive().Tip()->GetBlockHash()) { | |||||
return; | |||||
} | |||||
CBlockIndex *block = LookupBlockIndex(old_tip); | |||||
if (block && block->GetAncestor(::ChainActive().Height()) == | |||||
::ChainActive().Tip()) { | |||||
return; | |||||
} | |||||
} | |||||
SyncWithValidationInterfaceQueue(); | SyncWithValidationInterfaceQueue(); | ||||
} | } | ||||
std::unique_ptr<Handler> | std::unique_ptr<Handler> | ||||
handleRpc(const CRPCCommand &command) override { | handleRpc(const CRPCCommand &command) override { | ||||
return std::make_unique<RpcHandlerImpl>(command); | return std::make_unique<RpcHandlerImpl>(command); | ||||
} | } | ||||
bool rpcEnableDeprecated(const std::string &method) override { | bool rpcEnableDeprecated(const std::string &method) override { | ||||
return IsDeprecatedRPCEnabled(gArgs, method); | return IsDeprecatedRPCEnabled(gArgs, method); | ||||
} | } | ||||
void rpcRunLater(const std::string &name, std::function<void()> fn, | void rpcRunLater(const std::string &name, std::function<void()> fn, | ||||
Show All 19 Lines |