Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/node.cpp
Show First 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | #ifdef ENABLE_WALLET | ||||
} | } | ||||
return wallets; | return wallets; | ||||
#else | #else | ||||
throw std::logic_error( | throw std::logic_error( | ||||
"Node::getWallets() called in non-wallet build."); | "Node::getWallets() called in non-wallet build."); | ||||
#endif | #endif | ||||
} | } | ||||
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override { | std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override { | ||||
return MakeHandler(::uiInterface.InitMessage.connect(fn)); | return MakeHandler(::uiInterface.InitMessage_connect(fn)); | ||||
} | } | ||||
std::unique_ptr<Handler> handleMessageBox(MessageBoxFn fn) override { | std::unique_ptr<Handler> handleMessageBox(MessageBoxFn fn) override { | ||||
return MakeHandler(::uiInterface.ThreadSafeMessageBox.connect(fn)); | return MakeHandler(::uiInterface.ThreadSafeMessageBox_connect(fn)); | ||||
} | } | ||||
std::unique_ptr<Handler> handleQuestion(QuestionFn fn) override { | std::unique_ptr<Handler> handleQuestion(QuestionFn fn) override { | ||||
return MakeHandler(::uiInterface.ThreadSafeQuestion.connect(fn)); | return MakeHandler(::uiInterface.ThreadSafeQuestion_connect(fn)); | ||||
} | } | ||||
std::unique_ptr<Handler> | std::unique_ptr<Handler> | ||||
handleShowProgress(ShowProgressFn fn) override { | handleShowProgress(ShowProgressFn fn) override { | ||||
return MakeHandler(::uiInterface.ShowProgress.connect(fn)); | return MakeHandler(::uiInterface.ShowProgress_connect(fn)); | ||||
} | } | ||||
std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) override { | std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) override { | ||||
CHECK_WALLET(return MakeHandler(::uiInterface.LoadWallet.connect( | CHECK_WALLET(return MakeHandler(::uiInterface.LoadWallet_connect( | ||||
[fn](std::shared_ptr<CWallet> wallet) { | [fn](std::shared_ptr<CWallet> wallet) { | ||||
fn(MakeWallet(wallet)); | fn(MakeWallet(wallet)); | ||||
}))); | }))); | ||||
} | } | ||||
std::unique_ptr<Handler> handleNotifyNumConnectionsChanged( | std::unique_ptr<Handler> handleNotifyNumConnectionsChanged( | ||||
NotifyNumConnectionsChangedFn fn) override { | NotifyNumConnectionsChangedFn fn) override { | ||||
return MakeHandler( | return MakeHandler( | ||||
::uiInterface.NotifyNumConnectionsChanged.connect(fn)); | ::uiInterface.NotifyNumConnectionsChanged_connect(fn)); | ||||
} | } | ||||
std::unique_ptr<Handler> handleNotifyNetworkActiveChanged( | std::unique_ptr<Handler> handleNotifyNetworkActiveChanged( | ||||
NotifyNetworkActiveChangedFn fn) override { | NotifyNetworkActiveChangedFn fn) override { | ||||
return MakeHandler( | return MakeHandler( | ||||
::uiInterface.NotifyNetworkActiveChanged.connect(fn)); | ::uiInterface.NotifyNetworkActiveChanged_connect(fn)); | ||||
} | } | ||||
std::unique_ptr<Handler> | std::unique_ptr<Handler> | ||||
handleNotifyAlertChanged(NotifyAlertChangedFn fn) override { | handleNotifyAlertChanged(NotifyAlertChangedFn fn) override { | ||||
return MakeHandler(::uiInterface.NotifyAlertChanged.connect(fn)); | return MakeHandler(::uiInterface.NotifyAlertChanged_connect(fn)); | ||||
} | } | ||||
std::unique_ptr<Handler> | std::unique_ptr<Handler> | ||||
handleBannedListChanged(BannedListChangedFn fn) override { | handleBannedListChanged(BannedListChangedFn fn) override { | ||||
return MakeHandler(::uiInterface.BannedListChanged.connect(fn)); | return MakeHandler(::uiInterface.BannedListChanged_connect(fn)); | ||||
} | } | ||||
std::unique_ptr<Handler> | std::unique_ptr<Handler> | ||||
handleNotifyBlockTip(NotifyBlockTipFn fn) override { | handleNotifyBlockTip(NotifyBlockTipFn fn) override { | ||||
return MakeHandler(::uiInterface.NotifyBlockTip.connect( | return MakeHandler(::uiInterface.NotifyBlockTip_connect( | ||||
[fn](bool initial_download, const CBlockIndex *block) { | [fn](bool initial_download, const CBlockIndex *block) { | ||||
fn(initial_download, block->nHeight, block->GetBlockTime(), | fn(initial_download, block->nHeight, block->GetBlockTime(), | ||||
GuessVerificationProgress(Params().TxData(), block)); | GuessVerificationProgress(Params().TxData(), block)); | ||||
})); | })); | ||||
} | } | ||||
std::unique_ptr<Handler> | std::unique_ptr<Handler> | ||||
handleNotifyHeaderTip(NotifyHeaderTipFn fn) override { | handleNotifyHeaderTip(NotifyHeaderTipFn fn) override { | ||||
return MakeHandler(::uiInterface.NotifyHeaderTip.connect( | return MakeHandler(::uiInterface.NotifyHeaderTip_connect( | ||||
[fn](bool initial_download, const CBlockIndex *block) { | [fn](bool initial_download, const CBlockIndex *block) { | ||||
fn(initial_download, block->nHeight, block->GetBlockTime(), | fn(initial_download, block->nHeight, block->GetBlockTime(), | ||||
GuessVerificationProgress(Params().TxData(), block)); | GuessVerificationProgress(Params().TxData(), block)); | ||||
})); | })); | ||||
} | } | ||||
}; | }; | ||||
} // namespace | } // namespace | ||||
std::unique_ptr<Node> MakeNode() { | std::unique_ptr<Node> MakeNode() { | ||||
return std::make_unique<NodeImpl>(); | return std::make_unique<NodeImpl>(); | ||||
} | } | ||||
} // namespace interfaces | } // namespace interfaces |