Cleanup
This commit is contained in:
@@ -780,7 +780,7 @@ int32_t hush_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notaryi
|
|||||||
|
|
||||||
int32_t gettxout_scriptPubKey(uint8_t *scriptPubKey,int32_t maxsize,uint256 txid,int32_t n);
|
int32_t gettxout_scriptPubKey(uint8_t *scriptPubKey,int32_t maxsize,uint256 txid,int32_t n);
|
||||||
|
|
||||||
int32_t komodo_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys[64][33],int32_t numnotaries,uint8_t rmd160[20])
|
int32_t hush_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys[64][33],int32_t numnotaries,uint8_t rmd160[20])
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
if ( scriptlen == 25 && memcmp(&scriptPubKey[3],rmd160,20) == 0 )
|
if ( scriptlen == 25 && memcmp(&scriptPubKey[3],rmd160,20) == 0 )
|
||||||
@@ -858,7 +858,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
|||||||
continue;
|
continue;
|
||||||
if ( (scriptlen= gettxout_scriptPubKey(scriptPubKey,sizeof(scriptPubKey),block.vtx[i].vin[j].prevout.hash,block.vtx[i].vin[j].prevout.n)) > 0 )
|
if ( (scriptlen= gettxout_scriptPubKey(scriptPubKey,sizeof(scriptPubKey),block.vtx[i].vin[j].prevout.hash,block.vtx[i].vin[j].prevout.n)) > 0 )
|
||||||
{
|
{
|
||||||
if ( (k= komodo_notarycmp(scriptPubKey,scriptlen,pubkeys,numnotaries,rmd160)) >= 0 )
|
if ( (k= hush_notarycmp(scriptPubKey,scriptlen,pubkeys,numnotaries,rmd160)) >= 0 )
|
||||||
signedmask |= (1LL << k);
|
signedmask |= (1LL << k);
|
||||||
else if ( 0 && numvins >= 17 )
|
else if ( 0 && numvins >= 17 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -578,7 +578,7 @@ CScript hush_makeopret(CBlock *pblock, bool fNew)
|
|||||||
|
|
||||||
uint256 _hush_getblockhash(int32_t height);*/
|
uint256 _hush_getblockhash(int32_t height);*/
|
||||||
|
|
||||||
uint64_t komodo_seed(int32_t height)
|
uint64_t hush_seed(int32_t height)
|
||||||
{
|
{
|
||||||
uint64_t seed = 0;
|
uint64_t seed = 0;
|
||||||
/*if ( 0 ) // problem during init time, seeds are needed for loading blockindex, so null seeds...
|
/*if ( 0 ) // problem during init time, seeds are needed for loading blockindex, so null seeds...
|
||||||
@@ -659,7 +659,7 @@ bool hush_hardfork_active(uint32_t time)
|
|||||||
return isactive;
|
return isactive;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t komodo_isPoS(CBlock *pblock,int32_t height,bool fJustCheck)
|
int32_t hush_isPoS(CBlock *pblock,int32_t height,bool fJustCheck)
|
||||||
{
|
{
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@@ -1424,7 +1424,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he
|
|||||||
// lulz
|
// lulz
|
||||||
int32_t komodo_is_PeiceOfShit() { return(1); }
|
int32_t komodo_is_PeiceOfShit() { return(1); }
|
||||||
|
|
||||||
uint64_t komodo_notarypayamount(int32_t nHeight, int64_t notarycount)
|
uint64_t hush_notarypayamount(int32_t nHeight, int64_t notarycount)
|
||||||
{
|
{
|
||||||
int8_t curEra = 0; int64_t ret = 0;
|
int8_t curEra = 0; int64_t ret = 0;
|
||||||
// if we have an end block in the first era, find our current era
|
// if we have an end block in the first era, find our current era
|
||||||
@@ -1441,7 +1441,7 @@ uint64_t komodo_notarypayamount(int32_t nHeight, int64_t notarycount)
|
|||||||
|
|
||||||
if ( notarycount == 0 )
|
if ( notarycount == 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "komodo_notarypayamount failed num notaries is 0!\n");
|
fprintf(stderr, "hush_notarypayamount failed num notaries is 0!\n");
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
// Because of reorgs we cannot use the notarized height value.
|
// Because of reorgs we cannot use the notarized height value.
|
||||||
@@ -1471,7 +1471,7 @@ int32_t hush_getnotarizedheight(uint32_t timestamp,int32_t height, uint8_t *scri
|
|||||||
return(notarizedheight);
|
return(notarizedheight);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t komodo_notarypay(CMutableTransaction &txNew, std::vector<int8_t> &NotarizationNotaries, uint32_t timestamp, int32_t height, uint8_t *script, int32_t len)
|
uint64_t hush_notarypay(CMutableTransaction &txNew, std::vector<int8_t> &NotarizationNotaries, uint32_t timestamp, int32_t height, uint8_t *script, int32_t len)
|
||||||
{
|
{
|
||||||
// fetch notary pubkey array.
|
// fetch notary pubkey array.
|
||||||
uint64_t total = 0, AmountToPay = 0;
|
uint64_t total = 0, AmountToPay = 0;
|
||||||
@@ -1491,7 +1491,7 @@ uint64_t komodo_notarypay(CMutableTransaction &txNew, std::vector<int8_t> &Notar
|
|||||||
txNew.vout.resize(NotarizationNotaries.size()+1);
|
txNew.vout.resize(NotarizationNotaries.size()+1);
|
||||||
|
|
||||||
// Calcualte the amount to pay according to the current era.
|
// Calcualte the amount to pay according to the current era.
|
||||||
AmountToPay = komodo_notarypayamount(height,NotarizationNotaries.size());
|
AmountToPay = hush_notarypayamount(height,NotarizationNotaries.size());
|
||||||
if ( AmountToPay == 0 )
|
if ( AmountToPay == 0 )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
@@ -1566,7 +1566,7 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height)
|
|||||||
{
|
{
|
||||||
// Create the coinbase tx again, using the extracted data, this is the same function the miner uses, with the same data.
|
// Create the coinbase tx again, using the extracted data, this is the same function the miner uses, with the same data.
|
||||||
// This allows us to know exactly that the coinbase is correct.
|
// This allows us to know exactly that the coinbase is correct.
|
||||||
totalsats = komodo_notarypay(txNew, NotarizationNotaries, pblock->nTime, height, script, scriptlen);
|
totalsats = hush_notarypay(txNew, NotarizationNotaries, pblock->nTime, height, script, scriptlen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -650,7 +650,7 @@ uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uin
|
|||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
*seedp = komodo_seed(height);
|
*seedp = hush_seed(height);
|
||||||
portable_mutex_lock(&hush_mutex);
|
portable_mutex_lock(&hush_mutex);
|
||||||
for (i=0; i<17; i++)
|
for (i=0; i<17; i++)
|
||||||
{
|
{
|
||||||
@@ -725,7 +725,7 @@ void komodo_paxpricefeed(int32_t height,uint8_t *pricefeed,int32_t opretlen)
|
|||||||
uint64_t PAX_fiatdest(uint64_t *seedp,int32_t tokomodo,char *destaddr,uint8_t pubkey33[33],char *coinaddr,int32_t height,char *origbase,int64_t fiatoshis)
|
uint64_t PAX_fiatdest(uint64_t *seedp,int32_t tokomodo,char *destaddr,uint8_t pubkey33[33],char *coinaddr,int32_t height,char *origbase,int64_t fiatoshis)
|
||||||
{
|
{
|
||||||
uint8_t shortflag = 0; char base[4]; int32_t i,baseid; uint8_t addrtype,rmd160[20]; int64_t komodoshis = 0;
|
uint8_t shortflag = 0; char base[4]; int32_t i,baseid; uint8_t addrtype,rmd160[20]; int64_t komodoshis = 0;
|
||||||
*seedp = komodo_seed(height);
|
*seedp = hush_seed(height);
|
||||||
if ( (baseid= hush_baseid(origbase)) < 0 || baseid == MAX_CURRENCIES )
|
if ( (baseid= hush_baseid(origbase)) < 0 || baseid == MAX_CURRENCIES )
|
||||||
{
|
{
|
||||||
if ( 0 && origbase[0] != 0 )
|
if ( 0 && origbase[0] != 0 )
|
||||||
|
|||||||
@@ -3845,7 +3845,7 @@ bool static DisconnectTip(CValidationState &state, bool fBare = false) {
|
|||||||
CValidationState stateDummy;
|
CValidationState stateDummy;
|
||||||
|
|
||||||
// don't keep staking or invalid transactions
|
// don't keep staking or invalid transactions
|
||||||
if (tx.IsCoinBase() || ((i == (block.vtx.size() - 1)) && (ASSETCHAINS_STAKED && komodo_isPoS((CBlock *)&block,pindexDelete->GetHeight(),true) != 0)) || !AcceptToMemoryPool(mempool, stateDummy, tx, false, NULL))
|
if (tx.IsCoinBase() || ((i == (block.vtx.size() - 1)) && (ASSETCHAINS_STAKED && hush_isPoS((CBlock *)&block,pindexDelete->GetHeight(),true) != 0)) || !AcceptToMemoryPool(mempool, stateDummy, tx, false, NULL))
|
||||||
{
|
{
|
||||||
mempool.remove(tx, removed, true);
|
mempool.remove(tx, removed, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ uint64_t the_commission(const CBlock *block,int32_t height);
|
|||||||
int32_t hush_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33, void *ptr);
|
int32_t hush_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33, void *ptr);
|
||||||
int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex);
|
int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex);
|
||||||
int32_t hush_is_notarytx(const CTransaction& tx);
|
int32_t hush_is_notarytx(const CTransaction& tx);
|
||||||
uint64_t komodo_notarypay(CMutableTransaction &txNew, std::vector<int8_t> &NotarizationNotaries, uint32_t timestamp, int32_t height, uint8_t *script, int32_t len);
|
uint64_t hush_notarypay(CMutableTransaction &txNew, std::vector<int8_t> &NotarizationNotaries, uint32_t timestamp, int32_t height, uint8_t *script, int32_t len);
|
||||||
int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
|
int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
|
||||||
int32_t hush_getnotarizedheight(uint32_t timestamp,int32_t height, uint8_t *script, int32_t len);
|
int32_t hush_getnotarizedheight(uint32_t timestamp,int32_t height, uint8_t *script, int32_t len);
|
||||||
CScript komodo_mineropret(int32_t nHeight);
|
CScript komodo_mineropret(int32_t nHeight);
|
||||||
@@ -649,7 +649,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
int32_t scriptlen = (int32_t)pblock->vtx[1].vout[1].scriptPubKey.size();
|
int32_t scriptlen = (int32_t)pblock->vtx[1].vout[1].scriptPubKey.size();
|
||||||
if ( script[0] == OP_RETURN )
|
if ( script[0] == OP_RETURN )
|
||||||
{
|
{
|
||||||
uint64_t totalsats = komodo_notarypay(txNew, NotarizationNotaries, pblock->nTime, nHeight, script, scriptlen);
|
uint64_t totalsats = hush_notarypay(txNew, NotarizationNotaries, pblock->nTime, nHeight, script, scriptlen);
|
||||||
if ( totalsats == 0 )
|
if ( totalsats == 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not create notary payment, trying again.\n");
|
fprintf(stderr, "Could not create notary payment, trying again.\n");
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
|
|||||||
uint32_t hush_segid32(char *coinaddr);
|
uint32_t hush_segid32(char *coinaddr);
|
||||||
int64_t hush_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);
|
int64_t hush_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);
|
||||||
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *hushnotarized_heightp);
|
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *hushnotarized_heightp);
|
||||||
uint64_t komodo_notarypayamount(int32_t nHeight, int64_t notarycount);
|
uint64_t hush_notarypayamount(int32_t nHeight, int64_t notarycount);
|
||||||
int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
|
int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
|
||||||
|
|
||||||
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
|
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
|
||||||
@@ -1211,7 +1211,7 @@ UniValue getnotarypayinfo(const UniValue& params, bool fHelp, const CPubKey& myp
|
|||||||
balance = checkburnaddress(received, TotalNotaryPay, height, "REDVp3ox1pbcWYCzySadfHhk8UU3HM4k5x");
|
balance = checkburnaddress(received, TotalNotaryPay, height, "REDVp3ox1pbcWYCzySadfHhk8UU3HM4k5x");
|
||||||
|
|
||||||
notarycount = hush_notaries(notarypubkeys, height, chainActive[height]->GetBlockTime());
|
notarycount = hush_notaries(notarypubkeys, height, chainActive[height]->GetBlockTime());
|
||||||
NotaryPay = komodo_notarypayamount(height, notarycount)*notarycount;
|
NotaryPay = hush_notarypayamount(height, notarycount)*notarycount;
|
||||||
bool spent = (received != balance);
|
bool spent = (received != balance);
|
||||||
if ( !spent )
|
if ( !spent )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user