Skip to content
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

[Validation] [Masternode] [Test] SDMN (Shield Deterministic Masternodes) #2876

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Next Next commit
ProRegTx updated for shield DMNs
  • Loading branch information
panleone committed Sep 1, 2023
commit 0293cb1ec51bb72f7467832a3bf782f4f5cb6d9e
43 changes: 41 additions & 2 deletions src/evo/providertx.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,61 @@
#define PIVX_PROVIDERTX_H

#include "bls/bls_wrapper.h"
#include "primitives/transaction.h"
#include "netaddress.h"
#include "primitives/transaction.h"
#include "sapling/sapling_transaction.h"
#include "serialize.h"

#include <univalue.h>

// Proof of ownership/validity/unspentness for the collateral of a shield DMn

class ShieldDMNProof
{
public:
SpendDescription input;
CTxOut output;
std::vector<unsigned char> bindingSig;

ShieldDMNProof()
{
SetNull();
}

void SetNull()
{
input = SpendDescription();
output = CTxOut();
bindingSig.clear();
}

bool IsNull()
{
return output.IsNull() && bindingSig.empty() && input == SpendDescription();
}

SERIALIZE_METHODS(ShieldDMNProof, obj)
{
READWRITE(obj.input);
READWRITE(obj.output);
READWRITE(obj.bindingSig);
}
};


// Provider-Register tx payload

class ProRegPL
{
public:
static const uint16_t CURRENT_VERSION = 1;
static const uint16_t CURRENT_VERSION = 2;

public:
uint16_t nVersion{CURRENT_VERSION}; // message version
uint16_t nType{0}; // only 0 supported for now
uint16_t nMode{0}; // only 0 supported for now
COutPoint collateralOutpoint{UINT256_ZERO, (uint32_t)-1}; // if hash is null, we refer to a ProRegTx output
ShieldDMNProof shieldCollateral{ShieldDMNProof()}; // if null the ProRegTx refers to a transparent DMNs
CService addr;
CKeyID keyIDOwner;
CBLSPublicKey pubKeyOperator;
Expand All @@ -41,6 +79,7 @@ class ProRegPL
READWRITE(obj.nType);
READWRITE(obj.nMode);
READWRITE(obj.collateralOutpoint);
READWRITE(obj.shieldCollateral);
READWRITE(obj.addr);
READWRITE(obj.keyIDOwner);
READWRITE(obj.pubKeyOperator);
Expand Down