-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zmq #2
Zmq #2
Changes from all commits
69f9009
6471d44
f637c7e
977d707
a6fad3c
2d0b75a
774f207
1724e20
2477ad2
8f9d4c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -256,6 +256,9 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strComm | |
LogPrint("gobject", "MNGOVERNANCEOBJECTVOTE -- %s new\n", strHash); | ||
masternodeSync.BumpAssetLastTime("MNGOVERNANCEOBJECTVOTE"); | ||
vote.Relay(connman); | ||
|
||
// SEND NOTIFICATION TO ZMQ | ||
GetMainSignals().NotifyGovernanceVote(vote); | ||
} | ||
else { | ||
LogPrint("gobject", "MNGOVERNANCEOBJECTVOTE -- Rejected vote, error = %s\n", exception.what()); | ||
|
@@ -362,7 +365,7 @@ void CGovernanceManager::AddGovernanceObject(CGovernanceObject& govobj, CConnman | |
CGovernanceException exception; | ||
CheckOrphanVotes(govobj, exception, connman); | ||
|
||
//Send notifications to scripts / zmq | ||
// SEND NOTIFICATION TO ZMQ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tobe reverted in cleanup PR |
||
GetMainSignals().NotifyGovernanceObject(govobj); | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,8 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) { | |
g_signals.ScriptForMining.connect(boost::bind(&CValidationInterface::GetScriptForMining, pwalletIn, _1)); | ||
g_signals.BlockFound.connect(boost::bind(&CValidationInterface::ResetRequestCount, pwalletIn, _1)); | ||
g_signals.NewPoWValidBlock.connect(boost::bind(&CValidationInterface::NewPoWValidBlock, pwalletIn, _1, _2)); | ||
g_signals.NotifyGovernanceObject.connect(boost::bind(&CValidationInterface::NotifyGovernanceObject, pwalletIn, _1)); | ||
g_signals.NotifyGovernanceVote.connect(boost::bind(&CValidationInterface::NotifyGovernanceVote, pwalletIn, _1)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. already included, ignoring |
||
} | ||
|
||
void UnregisterValidationInterface(CValidationInterface* pwalletIn) { | ||
|
@@ -42,6 +44,8 @@ void UnregisterValidationInterface(CValidationInterface* pwalletIn) { | |
g_signals.NewPoWValidBlock.disconnect(boost::bind(&CValidationInterface::NewPoWValidBlock, pwalletIn, _1, _2)); | ||
g_signals.NotifyHeaderTip.disconnect(boost::bind(&CValidationInterface::NotifyHeaderTip, pwalletIn, _1, _2)); | ||
g_signals.AcceptedBlockHeader.disconnect(boost::bind(&CValidationInterface::AcceptedBlockHeader, pwalletIn, _1)); | ||
g_signals.NotifyGovernanceObject.disconnect(boost::bind(&CValidationInterface::NotifyGovernanceObject, pwalletIn, _1)); | ||
g_signals.NotifyGovernanceVote.disconnect(boost::bind(&CValidationInterface::NotifyGovernanceVote, pwalletIn, _1)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. already included |
||
} | ||
|
||
void UnregisterAllValidationInterfaces() { | ||
|
@@ -58,4 +62,6 @@ void UnregisterAllValidationInterfaces() { | |
g_signals.NewPoWValidBlock.disconnect_all_slots(); | ||
g_signals.NotifyHeaderTip.disconnect_all_slots(); | ||
g_signals.AcceptedBlockHeader.disconnect_all_slots(); | ||
g_signals.NotifyGovernanceObject.disconnect_all_slots(); | ||
g_signals.NotifyGovernanceVote.disconnect_all_slots(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. already included |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ class CZMQNotificationInterface : public CValidationInterface | |
// CValidationInterface | ||
void SyncTransaction(const CTransaction& tx, const CBlockIndex *pindex, int posInBlock) override; | ||
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override; | ||
void NotifyTransactionLock(const CTransaction &tx) override; | ||
void NotifyTransactionLock(const CTransaction& tx) override; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. todo in formatting pr |
||
void NotifyGovernanceVote(const CGovernanceVote& vote) override; | ||
void NotifyGovernanceObject(const CGovernanceObject& object) override; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,13 @@ static std::multimap<std::string, CZMQAbstractPublishNotifier*> mapPublishNotifi | |
static const char *MSG_HASHBLOCK = "hashblock"; | ||
static const char *MSG_HASHTX = "hashtx"; | ||
static const char *MSG_HASHTXLOCK = "hashtxlock"; | ||
static const char *MSG_HASHGVOTE = "hashgovernancevote"; | ||
static const char *MSG_HASHGOBJ = "hashgovernanceobject"; | ||
static const char *MSG_RAWBLOCK = "rawblock"; | ||
static const char *MSG_RAWTX = "rawtx"; | ||
static const char *MSG_RAWTXLOCK = "rawtxlock"; | ||
static const char *MSG_HASHGVOTE = "hashgovernancevote"; | ||
static const char *MSG_HASHGOBJ = "hashgovernanceobject"; | ||
static const char *MSG_RAWGOVERNANCEOBJECT = "rawgovernanceobject"; | ||
static const char *MSG_RAWGOVERNANCEVOTE = "rawgovernancevote"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shorten to |
||
|
||
|
||
// Internal function to send multipart message | ||
|
@@ -239,3 +241,21 @@ bool CZMQPublishHashGovernanceObjectNotifier::NotifyGovernanceObject(const CGove | |
data[31 - i] = hashData[i]; | ||
return SendMessage(MSG_HASHGOBJ, data, 32); | ||
} | ||
|
||
bool CZMQPublishRawGovernanceObjectNotifier::NotifyGovernanceObject(const CGovernanceObject& govobj) | ||
{ | ||
uint256 nHash = govobj.GetHash(); | ||
LogPrint("gobject", "gobject: Publish rawgovernanceobject: hash = %s, type = %d\n", nHash.ToString(), govobj.GetObjectType()); | ||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); | ||
ss << govobj; | ||
return SendMessage(MSG_RAWGOVERNANCEOBJECT, &(*ss.begin()), ss.size()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
bool CZMQPublishRawGovernanceVoteNotifier::NotifyGovernanceVote(const CGovernanceVote& vote) | ||
{ | ||
uint256 nHash = vote.GetHash(); | ||
LogPrint("gobject", "gobject: Publish rawgovernancevote: hash = %s, vote = %s\n", nHash.ToString(), vote.ToString()); | ||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); | ||
ss << vote; | ||
return SendMessage(MSG_RAWGOVERNANCEVOTE, &(*ss.begin()), ss.size()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i go with this, need to remove the one in ProcessVote