Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,12 @@ BITCOIN_CORE_H = \
evo/specialtxman.h \
evo/types.h \
dsnotificationinterface.h \
governance/governance.h \
governance/classes.h \
governance/common.h \
governance/governance.h \
governance/exceptions.h \
governance/object.h \
governance/signing.h \
governance/validators.h \
governance/vote.h \
governance/votedb.h \
Expand Down Expand Up @@ -510,6 +511,7 @@ libbitcoin_node_a_SOURCES = \
governance/exceptions.cpp \
governance/governance.cpp \
governance/object.cpp \
governance/signing.cpp \
governance/validators.cpp \
governance/vote.cpp \
governance/votedb.cpp \
Expand Down
25 changes: 0 additions & 25 deletions src/coinjoin/coinjoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <bls/bls.h>
#include <chainlock/chainlock.h>
#include <instantsend/instantsend.h>
#include <masternode/node.h>
#include <masternode/sync.h>

#include <string>
Expand Down Expand Up @@ -45,18 +44,6 @@ uint256 CCoinJoinQueue::GetSignatureHash() const
}
uint256 CCoinJoinQueue::GetHash() const { return SerializeHash(*this, SER_NETWORK, PROTOCOL_VERSION); }

bool CCoinJoinQueue::Sign(const CActiveMasternodeManager& mn_activeman)
{
uint256 hash = GetSignatureHash();
CBLSSignature sig = mn_activeman.Sign(hash, /*is_legacy=*/ false);
if (!sig.IsValid()) {
return false;
}
vchSig = sig.ToByteVector(false);

return true;
}

bool CCoinJoinQueue::CheckSignature(const CBLSPublicKey& blsPubKey) const
{
if (!CBLSSignature(Span{vchSig}, false).VerifyInsecure(blsPubKey, GetSignatureHash(), false)) {
Expand Down Expand Up @@ -84,18 +71,6 @@ uint256 CCoinJoinBroadcastTx::GetSignatureHash() const
return SerializeHash(*this, SER_GETHASH, PROTOCOL_VERSION);
}

bool CCoinJoinBroadcastTx::Sign(const CActiveMasternodeManager& mn_activeman)
{
uint256 hash = GetSignatureHash();
CBLSSignature sig = mn_activeman.Sign(hash, /*is_legacy=*/ false);
if (!sig.IsValid()) {
return false;
}
vchSig = sig.ToByteVector(false);

return true;
}

bool CCoinJoinBroadcastTx::CheckSignature(const CBLSPublicKey& blsPubKey) const
{
if (!CBLSSignature(Span{vchSig}, false).VerifyInsecure(blsPubKey, GetSignatureHash(), false)) {
Expand Down
12 changes: 1 addition & 11 deletions src/coinjoin/coinjoin.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
#include <optional>
#include <utility>

class CActiveMasternodeManager;
class CChainState;
class CBLSPublicKey;
class CBlockIndex;
class ChainstateManager;
class CMasternodeSync;
class CTxMemPool;
class TxValidationState;

namespace llmq {
class CChainLocksHandler;
Expand Down Expand Up @@ -209,14 +207,7 @@ class CCoinJoinQueue

[[nodiscard]] uint256 GetHash() const;
[[nodiscard]] uint256 GetSignatureHash() const;
/** Sign this mixing transaction
* return true if all conditions are met:
* 1) we have an active Masternode,
* 2) we have a valid Masternode private key,
* 3) we signed the message successfully, and
* 4) we verified the message successfully
*/
bool Sign(const CActiveMasternodeManager& mn_activeman);

/// Check if we have a valid Masternode address
[[nodiscard]] bool CheckSignature(const CBLSPublicKey& blsPubKey) const;

Expand Down Expand Up @@ -284,7 +275,6 @@ class CCoinJoinBroadcastTx

[[nodiscard]] uint256 GetSignatureHash() const;

bool Sign(const CActiveMasternodeManager& mn_activeman);
[[nodiscard]] bool CheckSignature(const CBLSPublicKey& blsPubKey) const;

// Used only for unit tests
Expand Down
6 changes: 3 additions & 3 deletions src/coinjoin/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void CCoinJoinServer::CommitFinalTransaction()
if (!m_dstxman.GetDSTX(hashTx)) {
CCoinJoinBroadcastTx dstxNew(finalTransaction, m_mn_activeman.GetOutPoint(), m_mn_activeman.GetProTxHash(),
GetAdjustedTime());
dstxNew.Sign(m_mn_activeman);
dstxNew.vchSig = m_mn_activeman.SignBasic(dstxNew.GetSignatureHash());
m_dstxman.AddDSTX(dstxNew);
}

Expand Down Expand Up @@ -497,7 +497,7 @@ void CCoinJoinServer::CheckForCompleteQueue()
GetAdjustedTime(), true);
LogPrint(BCLog::COINJOIN, "CCoinJoinServer::CheckForCompleteQueue -- queue is ready, signing and relaying (%s) " /* Continued */
"with %d participants\n", dsq.ToString(), vecSessionCollaterals.size());
dsq.Sign(m_mn_activeman);
dsq.vchSig = m_mn_activeman.SignBasic(dsq.GetSignatureHash());
m_peerman.RelayDSQ(dsq);
WITH_LOCK(cs_vecqueue, vecCoinJoinQueue.push_back(dsq));
}
Expand Down Expand Up @@ -707,7 +707,7 @@ bool CCoinJoinServer::CreateNewSession(const CCoinJoinAccept& dsa, PoolMessage&
CCoinJoinQueue dsq(nSessionDenom, m_mn_activeman.GetOutPoint(), m_mn_activeman.GetProTxHash(),
GetAdjustedTime(), false);
LogPrint(BCLog::COINJOIN, "CCoinJoinServer::CreateNewSession -- signing and relaying new queue: %s\n", dsq.ToString());
dsq.Sign(m_mn_activeman);
dsq.vchSig = m_mn_activeman.SignBasic(dsq.GetSignatureHash());
m_peerman.RelayDSQ(dsq);
LOCK(cs_vecqueue);
vecCoinJoinQueue.push_back(dsq);
Expand Down
6 changes: 1 addition & 5 deletions src/dsnotificationinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@
CDSNotificationInterface::CDSNotificationInterface(CConnman& connman,
CMasternodeSync& mn_sync,
CGovernanceManager& govman,
PeerManager& peerman,
const ChainstateManager& chainman,
const CActiveMasternodeManager* const mn_activeman,
const std::unique_ptr<CDeterministicMNManager>& dmnman,
const std::unique_ptr<LLMQContext>& llmq_ctx,
const std::unique_ptr<CJContext>& cj_ctx)
: m_connman(connman),
m_mn_sync(mn_sync),
m_govman(govman),
m_peerman(peerman),
m_chainman(chainman),
m_mn_activeman(mn_activeman),
m_dmnman(dmnman),
m_llmq_ctx(llmq_ctx),
m_cj_ctx(cj_ctx) {}
Expand Down Expand Up @@ -94,7 +90,7 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
m_llmq_ctx->qdkgsman->UpdatedBlockTip(pindexNew, fInitialDownload);

if (m_govman.IsValid()) {
m_govman.UpdatedBlockTip(pindexNew, m_connman, m_peerman, m_mn_activeman);
m_govman.UpdatedBlockTip(pindexNew);
}
}

Expand Down
6 changes: 0 additions & 6 deletions src/dsnotificationinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@

#include <validationinterface.h>

class CActiveMasternodeManager;
class CConnman;
class CDeterministicMNManager;
class CGovernanceManager;
class ChainstateManager;
class CMasternodeSync;
class PeerManager;
struct CJContext;
struct LLMQContext;

Expand All @@ -23,9 +21,7 @@ class CDSNotificationInterface : public CValidationInterface
explicit CDSNotificationInterface(CConnman& connman,
CMasternodeSync& mn_sync,
CGovernanceManager& govman,
PeerManager& peerman,
const ChainstateManager& chainman,
const CActiveMasternodeManager* const mn_activeman,
const std::unique_ptr<CDeterministicMNManager>& dmnman,
const std::unique_ptr<LLMQContext>& llmq_ctx,
const std::unique_ptr<CJContext>& cj_ctx);
Expand All @@ -52,9 +48,7 @@ class CDSNotificationInterface : public CValidationInterface
CConnman& m_connman;
CMasternodeSync& m_mn_sync;
CGovernanceManager& m_govman;
PeerManager& m_peerman;
const ChainstateManager& m_chainman;
const CActiveMasternodeManager* const m_mn_activeman;
const std::unique_ptr<CDeterministicMNManager>& m_dmnman;
const std::unique_ptr<LLMQContext>& m_llmq_ctx;
const std::unique_ptr<CJContext>& m_cj_ctx;
Expand Down
Loading
Loading