This commit is contained in:
Duke Leto
2022-02-14 14:10:08 -05:00
parent f971b1765e
commit a157a5c6a1
16 changed files with 66 additions and 66 deletions

View File

@@ -1375,7 +1375,7 @@ uint64_t hush_notarypayamount(int32_t nHeight, int64_t notarycount)
int32_t hush_getnotarizedheight(uint32_t timestamp,int32_t height, uint8_t *script, int32_t len)
{
// Check the notarisation is valid, and extract notarised height.
// Check the notarization is valid, and extract notarized height.
uint64_t voutmask;
uint8_t scriptbuf[10001];
int32_t isratification,specialtx,notarizedheight;
@@ -1403,7 +1403,7 @@ uint64_t hush_notarypay(CMutableTransaction &txNew, std::vector<int8_t> &Notariz
if ( notarypubkeys[0][0] == 0 )
return(0);
// Check the notarisation is valid.
// Check the notarization is valid.
int32_t notarizedheight = hush_getnotarizedheight(timestamp, height, script, len);
if ( notarizedheight == 0 )
return(0);
@@ -1416,7 +1416,7 @@ uint64_t hush_notarypay(CMutableTransaction &txNew, std::vector<int8_t> &Notariz
if ( AmountToPay == 0 )
return(0);
// loop over notarisation vins and add transaction to coinbase.
// loop over notarization vins and add transaction to coinbase.
// Commented prints here can be used to verify manually the pubkeys match.
for (int8_t n = 0; n < NotarizationNotaries.size(); n++)
{
@@ -1468,10 +1468,10 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height)
if ( !GetNotarizationNotaries(notarypubkeys, numSN, pblock->vtx[1].vin, NotarizationNotaries) )
return(0);
// check a notary didnt sign twice (this would be an invalid notarisation later on and cause problems)
// check a notary didnt sign twice (this would be an invalid notarization later on and cause problems)
std::set<int> checkdupes( NotarizationNotaries.begin(), NotarizationNotaries.end() );
if ( checkdupes.size() != NotarizationNotaries.size() ) {
fprintf(stderr, "Possible notarisation is signed multiple times by same notary. It is invalid.\n");
fprintf(stderr, "Possible notarization is signed multiple times by same notary. It is invalid.\n");
return(0);
}
const CChainParams& chainparams = Params();
@@ -1480,7 +1480,7 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height)
CMutableTransaction txNew = CreateNewContextualCMutableTransaction(consensusParams, height);
if ( pblock->vtx[1].vout.size() == 2 && pblock->vtx[1].vout[1].nValue == 0 )
{
// Get the OP_RETURN for the notarisation
// Get the OP_RETURN for the notarization
uint8_t *script = (uint8_t *)&pblock->vtx[1].vout[1].scriptPubKey[0];
int32_t scriptlen = (int32_t)pblock->vtx[1].vout[1].scriptPubKey.size();
if ( script[0] == OP_RETURN )
@@ -1491,13 +1491,13 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height)
}
else
{
fprintf(stderr, "vout 2 of notarisation is not OP_RETURN scriptlen.%i\n", scriptlen);
fprintf(stderr, "vout 2 of notarization is not OP_RETURN scriptlen.%i\n", scriptlen);
return(0);
}
} else return(0);
// if notarypay fails, because the notarisation is not valid, exit now as txNew was not created.
// This should never happen, as the notarisation is checked before this function is called.
// if notarypay fails, because the notarization is not valid, exit now as txNew was not created.
// This should never happen, as the notarization is checked before this function is called.
if ( totalsats == 0 )
{
fprintf(stderr, "notary pay returned 0!\n");
@@ -1519,7 +1519,7 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height)
n++;
continue;
}
// Check the pubkeys match the pubkeys in the notarisation.
// Check the pubkeys match the pubkeys in the notarization.
script = (uint8_t *)&txout.scriptPubKey[0];
scriptlen = (int32_t)txout.scriptPubKey.size();
if ( scriptlen == 35 && script[0] == 33 && script[34] == OP_CHECKSIG && memcmp(script+1,notarypubkeys[NotarizationNotaries[n-1]],33) == 0 )
@@ -1537,7 +1537,7 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height)
}
if ( matches != 0 && matches == NotarizationNotaries.size() && totalsats == total )
{
//fprintf(stderr, "Validated coinbase matches notarisation in tx position 1.\n" );
//fprintf(stderr, "Validated coinbase matches notarization in tx position 1.\n" );
return(totalsats);
}
return(0);
@@ -1757,10 +1757,10 @@ int32_t hush_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
// We check the full validation in ConnectBlock directly to get the amount for coinbase. So just approx here.
if ( slowflag == 0 && pblock->vtx[0].vout.size() > 1 )
{
// Check the notarisation tx is to the crypto address.
// Check the notarization tx is to the crypto address.
if ( !hush_is_notarytx(pblock->vtx[1]) == 1 )
{
fprintf(stderr, "notarisation is not to crypto address ht.%i\n",height);
fprintf(stderr, "notarization is not to crypto address ht.%i\n",height);
return(-1);
}
// Check min sigs.