Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

providertx.cpp
Go to the documentation of this file.
1 // Copyright (c) 2018-2019 The Dash Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <evo/deterministicmns.h>
6 #include <evo/providertx.h>
7 #include <evo/specialtx.h>
8 
9 #include <base58.h>
10 #include <chainparams.h>
11 #include <clientversion.h>
12 #include <core_io.h>
13 #include <hash.h>
14 #include <messagesigner.h>
15 #include <script/standard.h>
16 #include <streams.h>
17 #include <univalue.h>
18 #include <validation.h>
19 
20 template <typename ProTx>
21 static bool CheckService(const uint256& proTxHash, const ProTx& proTx, CValidationState& state)
22 {
23  if (!proTx.addr.IsValid()) {
24  return state.DoS(10, false, REJECT_INVALID, "bad-protx-ipaddr");
25  }
26  if (Params().RequireRoutableExternalIP() && !proTx.addr.IsRoutable()) {
27  return state.DoS(10, false, REJECT_INVALID, "bad-protx-ipaddr");
28  }
29 
30  static int mainnetDefaultPort = CreateChainParams(CBaseChainParams::MAIN)->GetDefaultPort();
31  if (Params().NetworkIDString() == CBaseChainParams::MAIN) {
32  if (proTx.addr.GetPort() != mainnetDefaultPort) {
33  return state.DoS(10, false, REJECT_INVALID, "bad-protx-ipaddr-port");
34  }
35  } else if (proTx.addr.GetPort() == mainnetDefaultPort) {
36  return state.DoS(10, false, REJECT_INVALID, "bad-protx-ipaddr-port");
37  }
38 
39  if (!proTx.addr.IsIPv4()) {
40  return state.DoS(10, false, REJECT_INVALID, "bad-protx-ipaddr");
41  }
42 
43  return true;
44 }
45 
46 template <typename ProTx>
47 static bool CheckHashSig(const ProTx& proTx, const CKeyID& keyID, CValidationState& state)
48 {
49  std::string strError;
50  if (!CHashSigner::VerifyHash(::SerializeHash(proTx), keyID, proTx.vchSig, strError)) {
51  return state.DoS(100, false, REJECT_INVALID, "bad-protx-sig", false, strError);
52  }
53  return true;
54 }
55 
56 template <typename ProTx>
57 static bool CheckStringSig(const ProTx& proTx, const CKeyID& keyID, CValidationState& state)
58 {
59  std::string strError;
60  if (!CMessageSigner::VerifyMessage(keyID, proTx.vchSig, proTx.MakeSignString(), strError)) {
61  return state.DoS(100, false, REJECT_INVALID, "bad-protx-sig", false, strError);
62  }
63  return true;
64 }
65 
66 template <typename ProTx>
67 static bool CheckHashSig(const ProTx& proTx, const CBLSPublicKey& pubKey, CValidationState& state)
68 {
69  if (!proTx.sig.VerifyInsecure(pubKey, ::SerializeHash(proTx))) {
70  return state.DoS(100, false, REJECT_INVALID, "bad-protx-sig", false);
71  }
72  return true;
73 }
74 
75 template <typename ProTx>
76 static bool CheckInputsHash(const CTransaction& tx, const ProTx& proTx, CValidationState& state)
77 {
78  uint256 inputsHash = CalcTxInputsHash(tx);
79  if (inputsHash != proTx.inputsHash) {
80  return state.DoS(100, false, REJECT_INVALID, "bad-protx-inputs-hash");
81  }
82 
83  return true;
84 }
85 
86 bool CheckProRegTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidationState& state)
87 {
89  return state.DoS(100, false, REJECT_INVALID, "bad-protx-type");
90  }
91 
92  CProRegTx ptx;
93  if (!GetTxPayload(tx, ptx)) {
94  return state.DoS(100, false, REJECT_INVALID, "bad-protx-payload");
95  }
96 
97  if (ptx.nVersion == 0 || ptx.nVersion > CProRegTx::CURRENT_VERSION) {
98  return state.DoS(100, false, REJECT_INVALID, "bad-protx-version");
99  }
100  if (ptx.nType != 0) {
101  return state.DoS(100, false, REJECT_INVALID, "bad-protx-type");
102  }
103  if (ptx.nMode != 0) {
104  return state.DoS(100, false, REJECT_INVALID, "bad-protx-mode");
105  }
106 
107  if (ptx.keyIDOwner.IsNull() || !ptx.pubKeyOperator.IsValid() || ptx.keyIDVoting.IsNull()) {
108  return state.DoS(10, false, REJECT_INVALID, "bad-protx-key-null");
109  }
111  return state.DoS(10, false, REJECT_INVALID, "bad-protx-payee");
112  }
113 
114  CTxDestination payoutDest;
115  if (!ExtractDestination(ptx.scriptPayout, payoutDest)) {
116  // should not happen as we checked script types before
117  return state.DoS(10, false, REJECT_INVALID, "bad-protx-payee-dest");
118  }
119  // don't allow reuse of payout key for other keys (don't allow people to put the payee key onto an online server)
120  if (payoutDest == CTxDestination(ptx.keyIDOwner) || payoutDest == CTxDestination(ptx.keyIDVoting)) {
121  return state.DoS(10, false, REJECT_INVALID, "bad-protx-payee-reuse");
122  }
123 
124  // It's allowed to set addr to 0, which will put the MN into PoSe-banned state and require a ProUpServTx to be issues later
125  // If any of both is set, it must be valid however
126  if (ptx.addr != CService() && !CheckService(tx.GetHash(), ptx, state)) {
127  // pass the state returned by the function above
128  return false;
129  }
130 
131  if (ptx.nOperatorReward > 10000) {
132  return state.DoS(10, false, REJECT_INVALID, "bad-protx-operator-reward");
133  }
134 
135  CTxDestination collateralTxDest;
136  const CKeyID *keyForPayloadSig = nullptr;
137  COutPoint collateralOutpoint;
138 
139  if (!ptx.collateralOutpoint.hash.IsNull()) {
140  Coin coin;
141  if (!GetUTXOCoin(ptx.collateralOutpoint, coin) || coin.out.nValue != 1000 * COIN) {
142  return state.DoS(10, false, REJECT_INVALID, "bad-protx-collateral");
143  }
144 
145  if (!ExtractDestination(coin.out.scriptPubKey, collateralTxDest)) {
146  return state.DoS(10, false, REJECT_INVALID, "bad-protx-collateral-dest");
147  }
148 
149  // Extract key from collateral. This only works for P2PK and P2PKH collaterals and will fail for P2SH.
150  // Issuer of this ProRegTx must prove ownership with this key by signing the ProRegTx
151  keyForPayloadSig = boost::get<CKeyID>(&collateralTxDest);
152  if (!keyForPayloadSig) {
153  return state.DoS(10, false, REJECT_INVALID, "bad-protx-collateral-pkh");
154  }
155 
156  collateralOutpoint = ptx.collateralOutpoint;
157  } else {
158  if (ptx.collateralOutpoint.n >= tx.vout.size()) {
159  return state.DoS(10, false, REJECT_INVALID, "bad-protx-collateral-index");
160  }
161  if (tx.vout[ptx.collateralOutpoint.n].nValue != 1000 * COIN) {
162  return state.DoS(10, false, REJECT_INVALID, "bad-protx-collateral");
163  }
164 
165  if (!ExtractDestination(tx.vout[ptx.collateralOutpoint.n].scriptPubKey, collateralTxDest)) {
166  return state.DoS(10, false, REJECT_INVALID, "bad-protx-collateral-dest");
167  }
168 
169  collateralOutpoint = COutPoint(tx.GetHash(), ptx.collateralOutpoint.n);
170  }
171 
172  // don't allow reuse of collateral key for other keys (don't allow people to put the collateral key onto an online server)
173  // this check applies to internal and external collateral, but internal collaterals are not necessarely a P2PKH
174  if (collateralTxDest == CTxDestination(ptx.keyIDOwner) || collateralTxDest == CTxDestination(ptx.keyIDVoting)) {
175  return state.DoS(10, false, REJECT_INVALID, "bad-protx-collateral-reuse");
176  }
177 
178  if (pindexPrev) {
179  auto mnList = deterministicMNManager->GetListForBlock(pindexPrev);
180 
181  // only allow reusing of addresses when it's for the same collateral (which replaces the old MN)
182  if (mnList.HasUniqueProperty(ptx.addr) && mnList.GetUniquePropertyMN(ptx.addr)->collateralOutpoint != collateralOutpoint) {
183  return state.DoS(10, false, REJECT_DUPLICATE, "bad-protx-dup-addr");
184  }
185 
186  // never allow duplicate keys, even if this ProTx would replace an existing MN
187  if (mnList.HasUniqueProperty(ptx.keyIDOwner) || mnList.HasUniqueProperty(ptx.pubKeyOperator)) {
188  return state.DoS(10, false, REJECT_DUPLICATE, "bad-protx-dup-key");
189  }
190 
191  if (!deterministicMNManager->IsDIP3Enforced(pindexPrev->nHeight)) {
192  if (ptx.keyIDOwner != ptx.keyIDVoting) {
193  return state.DoS(10, false, REJECT_INVALID, "bad-protx-key-not-same");
194  }
195  }
196  }
197 
198  if (!CheckInputsHash(tx, ptx, state)) {
199  return false;
200  }
201 
202  if (keyForPayloadSig) {
203  // collateral is not part of this ProRegTx, so we must verify ownership of the collateral
204  if (!CheckStringSig(ptx, *keyForPayloadSig, state)) {
205  // pass the state returned by the function above
206  return false;
207  }
208  } else {
209  // collateral is part of this ProRegTx, so we know the collateral is owned by the issuer
210  if (!ptx.vchSig.empty()) {
211  return state.DoS(100, false, REJECT_INVALID, "bad-protx-sig");
212  }
213  }
214 
215  return true;
216 }
217 
218 bool CheckProUpServTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidationState& state)
219 {
221  return state.DoS(100, false, REJECT_INVALID, "bad-protx-type");
222  }
223 
224  CProUpServTx ptx;
225  if (!GetTxPayload(tx, ptx)) {
226  return state.DoS(100, false, REJECT_INVALID, "bad-protx-payload");
227  }
228 
229  if (ptx.nVersion == 0 || ptx.nVersion > CProUpServTx::CURRENT_VERSION) {
230  return state.DoS(100, false, REJECT_INVALID, "bad-protx-version");
231  }
232 
233  if (!CheckService(ptx.proTxHash, ptx, state)) {
234  // pass the state returned by the function above
235  return false;
236  }
237 
238  if (pindexPrev) {
239  auto mnList = deterministicMNManager->GetListForBlock(pindexPrev);
240  auto mn = mnList.GetMN(ptx.proTxHash);
241  if (!mn) {
242  return state.DoS(100, false, REJECT_INVALID, "bad-protx-hash");
243  }
244 
245  // don't allow updating to addresses already used by other MNs
246  if (mnList.HasUniqueProperty(ptx.addr) && mnList.GetUniquePropertyMN(ptx.addr)->proTxHash != ptx.proTxHash) {
247  return state.DoS(10, false, REJECT_DUPLICATE, "bad-protx-dup-addr");
248  }
249 
250  if (ptx.scriptOperatorPayout != CScript()) {
251  if (mn->nOperatorReward == 0) {
252  // don't allow to set operator reward payee in case no operatorReward was set
253  return state.DoS(10, false, REJECT_INVALID, "bad-protx-operator-payee");
254  }
256  return state.DoS(10, false, REJECT_INVALID, "bad-protx-operator-payee");
257  }
258  }
259 
260  // we can only check the signature if pindexPrev != nullptr and the MN is known
261  if (!CheckInputsHash(tx, ptx, state)) {
262  // pass the state returned by the function above
263  return false;
264  }
265  if (!CheckHashSig(ptx, mn->pdmnState->pubKeyOperator.Get(), state)) {
266  // pass the state returned by the function above
267  return false;
268  }
269  }
270 
271  return true;
272 }
273 
274 bool CheckProUpRegTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidationState& state)
275 {
277  return state.DoS(100, false, REJECT_INVALID, "bad-protx-type");
278  }
279 
280  CProUpRegTx ptx;
281  if (!GetTxPayload(tx, ptx)) {
282  return state.DoS(100, false, REJECT_INVALID, "bad-protx-payload");
283  }
284 
285  if (ptx.nVersion == 0 || ptx.nVersion > CProUpRegTx::CURRENT_VERSION) {
286  return state.DoS(100, false, REJECT_INVALID, "bad-protx-version");
287  }
288  if (ptx.nMode != 0) {
289  return state.DoS(100, false, REJECT_INVALID, "bad-protx-mode");
290  }
291 
292  if (!ptx.pubKeyOperator.IsValid() || ptx.keyIDVoting.IsNull()) {
293  return state.DoS(10, false, REJECT_INVALID, "bad-protx-key-null");
294  }
296  return state.DoS(10, false, REJECT_INVALID, "bad-protx-payee");
297  }
298 
299  CTxDestination payoutDest;
300  if (!ExtractDestination(ptx.scriptPayout, payoutDest)) {
301  // should not happen as we checked script types before
302  return state.DoS(10, false, REJECT_INVALID, "bad-protx-payee-dest");
303  }
304 
305  if (pindexPrev) {
306  auto mnList = deterministicMNManager->GetListForBlock(pindexPrev);
307  auto dmn = mnList.GetMN(ptx.proTxHash);
308  if (!dmn) {
309  return state.DoS(100, false, REJECT_INVALID, "bad-protx-hash");
310  }
311 
312  // don't allow reuse of payee key for other keys (don't allow people to put the payee key onto an online server)
313  if (payoutDest == CTxDestination(dmn->pdmnState->keyIDOwner) || payoutDest == CTxDestination(ptx.keyIDVoting)) {
314  return state.DoS(10, false, REJECT_INVALID, "bad-protx-payee-reuse");
315  }
316 
317  Coin coin;
318  if (!GetUTXOCoin(dmn->collateralOutpoint, coin)) {
319  // this should never happen (there would be no dmn otherwise)
320  return state.DoS(100, false, REJECT_INVALID, "bad-protx-collateral");
321  }
322 
323  // don't allow reuse of collateral key for other keys (don't allow people to put the collateral key onto an online server)
324  CTxDestination collateralTxDest;
325  if (!ExtractDestination(coin.out.scriptPubKey, collateralTxDest)) {
326  return state.DoS(100, false, REJECT_INVALID, "bad-protx-collateral-dest");
327  }
328  if (collateralTxDest == CTxDestination(dmn->pdmnState->keyIDOwner) || collateralTxDest == CTxDestination(ptx.keyIDVoting)) {
329  return state.DoS(10, false, REJECT_INVALID, "bad-protx-collateral-reuse");
330  }
331 
332  if (mnList.HasUniqueProperty(ptx.pubKeyOperator)) {
333  auto otherDmn = mnList.GetUniquePropertyMN(ptx.pubKeyOperator);
334  if (ptx.proTxHash != otherDmn->proTxHash) {
335  return state.DoS(10, false, REJECT_DUPLICATE, "bad-protx-dup-key");
336  }
337  }
338 
339  if (!deterministicMNManager->IsDIP3Enforced(pindexPrev->nHeight)) {
340  if (dmn->pdmnState->keyIDOwner != ptx.keyIDVoting) {
341  return state.DoS(10, false, REJECT_INVALID, "bad-protx-key-not-same");
342  }
343  }
344 
345  if (!CheckInputsHash(tx, ptx, state)) {
346  // pass the state returned by the function above
347  return false;
348  }
349  if (!CheckHashSig(ptx, dmn->pdmnState->keyIDOwner, state)) {
350  // pass the state returned by the function above
351  return false;
352  }
353  }
354 
355  return true;
356 }
357 
358 bool CheckProUpRevTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidationState& state)
359 {
361  return state.DoS(100, false, REJECT_INVALID, "bad-protx-type");
362  }
363 
364  CProUpRevTx ptx;
365  if (!GetTxPayload(tx, ptx)) {
366  return state.DoS(100, false, REJECT_INVALID, "bad-protx-payload");
367  }
368 
369  if (ptx.nVersion == 0 || ptx.nVersion > CProUpRevTx::CURRENT_VERSION) {
370  return state.DoS(100, false, REJECT_INVALID, "bad-protx-version");
371  }
372 
373  // ptx.nReason < CProUpRevTx::REASON_NOT_SPECIFIED is always `false` since
374  // ptx.nReason is unsigned and CProUpRevTx::REASON_NOT_SPECIFIED == 0
375  if (ptx.nReason > CProUpRevTx::REASON_LAST) {
376  return state.DoS(100, false, REJECT_INVALID, "bad-protx-reason");
377  }
378 
379  if (pindexPrev) {
380  auto mnList = deterministicMNManager->GetListForBlock(pindexPrev);
381  auto dmn = mnList.GetMN(ptx.proTxHash);
382  if (!dmn)
383  return state.DoS(100, false, REJECT_INVALID, "bad-protx-hash");
384 
385  if (!CheckInputsHash(tx, ptx, state)) {
386  // pass the state returned by the function above
387  return false;
388  }
389  if (!CheckHashSig(ptx, dmn->pdmnState->pubKeyOperator.Get(), state)) {
390  // pass the state returned by the function above
391  return false;
392  }
393  }
394 
395  return true;
396 }
397 
398 std::string CProRegTx::MakeSignString() const
399 {
400  std::string s;
401 
402  // We only include the important stuff in the string form...
403 
404  CTxDestination destPayout;
405  std::string strPayout;
406  if (ExtractDestination(scriptPayout, destPayout)) {
407  strPayout = EncodeDestination(destPayout);
408  } else {
409  strPayout = HexStr(scriptPayout.begin(), scriptPayout.end());
410  }
411 
412  s += strPayout + "|";
413  s += strprintf("%d", nOperatorReward) + "|";
414  s += EncodeDestination(keyIDOwner) + "|";
415  s += EncodeDestination(keyIDVoting) + "|";
416 
417  // ... and also the full hash of the payload as a protection agains malleability and replays
418  s += ::SerializeHash(*this).ToString();
419 
420  return s;
421 }
422 
423 std::string CProRegTx::ToString() const
424 {
425  CTxDestination dest;
426  std::string payee = "unknown";
427  if (ExtractDestination(scriptPayout, dest)) {
428  payee = EncodeDestination(dest);
429  }
430 
431  return strprintf("CProRegTx(nVersion=%d, collateralOutpoint=%s, addr=%s, nOperatorReward=%f, ownerAddress=%s, pubKeyOperator=%s, votingAddress=%s, scriptPayout=%s)",
433 }
434 
435 std::string CProUpServTx::ToString() const
436 {
437  CTxDestination dest;
438  std::string payee = "unknown";
440  payee = EncodeDestination(dest);
441  }
442 
443  return strprintf("CProUpServTx(nVersion=%d, proTxHash=%s, addr=%s, operatorPayoutAddress=%s)",
444  nVersion, proTxHash.ToString(), addr.ToString(), payee);
445 }
446 
447 std::string CProUpRegTx::ToString() const
448 {
449  CTxDestination dest;
450  std::string payee = "unknown";
451  if (ExtractDestination(scriptPayout, dest)) {
452  payee = EncodeDestination(dest);
453  }
454 
455  return strprintf("CProUpRegTx(nVersion=%d, proTxHash=%s, pubKeyOperator=%s, votingAddress=%s, payoutAddress=%s)",
457 }
458 
459 std::string CProUpRevTx::ToString() const
460 {
461  return strprintf("CProUpRevTx(nVersion=%d, proTxHash=%s, nReason=%d)",
463 }
uint16_t nMode
Definition: providertx.h:143
bool GetTxPayload(const std::vector< unsigned char > &payload, T &obj)
Definition: specialtx.h:21
CAmount nValue
Definition: transaction.h:147
bool CheckProUpServTx(const CTransaction &tx, const CBlockIndex *pindexPrev, CValidationState &state)
Definition: providertx.cpp:218
static bool VerifyHash(const uint256 &hash, const CPubKey &pubkey, const std::vector< unsigned char > &vchSig, std::string &strErrorRet)
Verify the hash signature, returns true if succcessful.
uint256 proTxHash
Definition: providertx.h:142
uint256 proTxHash
Definition: providertx.h:95
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:80
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
Definition: standard.cpp:158
CKeyID keyIDVoting
Definition: providertx.h:145
std::string ToString(bool fUseGetnameinfo=true) const
Definition: netaddress.cpp:581
static const uint16_t CURRENT_VERSION
Definition: providertx.h:138
CScript scriptPubKey
Definition: transaction.h:148
std::vector< unsigned char > vchSig
Definition: providertx.h:36
COutPoint collateralOutpoint
Definition: providertx.h:28
A UTXO entry.
Definition: coins.h:29
#define strprintf
Definition: tinyformat.h:1066
bool IsPayToScriptHash() const
Definition: script.cpp:212
static const CAmount COIN
Definition: amount.h:14
static bool CheckStringSig(const ProTx &proTx, const CKeyID &keyID, CValidationState &state)
Definition: providertx.cpp:57
CTxOut out
unspent transaction output
Definition: coins.h:33
uint256 CalcTxInputsHash(const CTransaction &tx)
Definition: specialtx.cpp:174
std::string ToString() const
Definition: providertx.cpp:447
std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)
CScript scriptOperatorPayout
Definition: providertx.h:97
CKeyID keyIDVoting
Definition: providertx.h:32
bool DoS(int level, bool ret=false, unsigned int chRejectCodeIn=0, const std::string &strRejectReasonIn="", bool corruptionIn=false, const std::string &strDebugMessageIn="")
Definition: validation.h:36
std::string ToString() const
Definition: providertx.cpp:435
CBLSPublicKey pubKeyOperator
Definition: providertx.h:144
static const uint16_t CURRENT_VERSION
Definition: providertx.h:91
std::unique_ptr< CDeterministicMNManager > deterministicMNManager
static const unsigned char REJECT_INVALID
Definition: validation.h:13
std::string ToString() const
Definition: providertx.cpp:459
bool IsNull() const
Definition: uint256.h:33
static bool CheckInputsHash(const CTransaction &tx, const ProTx &proTx, CValidationState &state)
Definition: providertx.cpp:76
static bool VerifyMessage(const CPubKey &pubkey, const std::vector< unsigned char > &vchSig, const std::string &strMessage, std::string &strErrorRet)
Verify the message signature, returns true if succcessful.
static const std::string MAIN
BIP70 chain name strings (main, test or regtest)
static bool CheckHashSig(const ProTx &proTx, const CKeyID &keyID, CValidationState &state)
Definition: providertx.cpp:47
uint256 SerializeHash(const T &obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
Compute the 256-bit hash of an object&#39;s serialization.
Definition: hash.h:254
iterator end()
Definition: prevector.h:320
bool GetUTXOCoin(const COutPoint &outpoint, Coin &coin)
Definition: validation.cpp:439
std::unique_ptr< CChainParams > CreateChainParams(const std::string &chain)
Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
std::string ToString() const
Definition: bls.h:210
const uint256 & GetHash() const
Definition: transaction.h:256
CService addr
Definition: providertx.h:96
static const uint16_t CURRENT_VERSION
Definition: providertx.h:22
A combination of a network address (CNetAddr) and a (TCP) port.
Definition: netaddress.h:143
std::string MakeSignString() const
Definition: providertx.cpp:398
uint32_t n
Definition: transaction.h:30
const std::vector< CTxOut > vout
Definition: transaction.h:216
CKeyID keyIDOwner
Definition: providertx.h:30
uint16_t nVersion
Definition: providertx.h:25
bool CheckProRegTx(const CTransaction &tx, const CBlockIndex *pindexPrev, CValidationState &state)
Definition: providertx.cpp:86
bool CheckProUpRevTx(const CTransaction &tx, const CBlockIndex *pindexPrev, CValidationState &state)
Definition: providertx.cpp:358
uint16_t nType
Definition: providertx.h:26
std::string ToString() const
Definition: uint256.cpp:62
CScript scriptPayout
Definition: providertx.h:34
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:26
static const unsigned char REJECT_DUPLICATE
Definition: validation.h:15
CScript scriptPayout
Definition: providertx.h:146
uint16_t nMode
Definition: providertx.h:27
uint16_t nOperatorReward
Definition: providertx.h:33
Capture information about block/transaction validation.
Definition: validation.h:22
256-bit opaque blob.
Definition: uint256.h:123
std::string ToString() const
Definition: providertx.cpp:423
static const uint16_t CURRENT_VERSION
Definition: providertx.h:190
std::string EncodeDestination(const CTxDestination &dest)
Definition: base58.cpp:329
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:170
const CChainParams & Params()
Return the currently selected parameters.
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:389
bool CheckProUpRegTx(const CTransaction &tx, const CBlockIndex *pindexPrev, CValidationState &state)
Definition: providertx.cpp:274
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:20
uint16_t nVersion
Definition: providertx.h:94
uint16_t nReason
Definition: providertx.h:204
iterator begin()
Definition: prevector.h:318
static bool CheckService(const uint256 &proTxHash, const ProTx &proTx, CValidationState &state)
Definition: providertx.cpp:21
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:198
int nHeight
height of the entry in the chain. The genesis block has height 0
Definition: chain.h:183
uint16_t nVersion
Definition: providertx.h:202
uint16_t nVersion
Definition: providertx.h:141
const int16_t nType
Definition: transaction.h:218
bool IsPayToPublicKeyHash() const
Definition: script.cpp:201
CBLSPublicKey pubKeyOperator
Definition: providertx.h:31
bool IsValid() const
Definition: bls.h:94
uint256 proTxHash
Definition: providertx.h:203
CService addr
Definition: providertx.h:29
uint256 hash
Definition: transaction.h:29
std::string ToStringShort() const
Definition: transaction.cpp:17
Released under the MIT license