Once men turned their thinking over to machines in the hope that this would set them free.

But that only permitted other men with machines to enslave them.

      --  Reverend Mother Gaius Helen Mohiam
This commit is contained in:
Duke Leto
2020-12-09 07:23:08 -05:00
parent 710559576c
commit 6a30b40415
30 changed files with 346 additions and 458 deletions

View File

@@ -1,3 +1,6 @@
// Copyright (c) 2016-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
/******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. *
* *
@@ -13,10 +16,7 @@
* *
******************************************************************************/
/*
CCutils has low level functions that are universally useful for all contracts.
*/
// CCutils has low level functions that are universally useful for all contracts.
#include "CCinclude.h"
#include "hush_structs.h"
#include "key_io.h"
@@ -28,7 +28,7 @@
#endif // TESTMODE
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
struct hush_state *hush_stateptr(char *symbol,char *dest);
extern uint32_t KOMODO_DPOWCONFS;
extern uint32_t HUSH_DPOWCONFS;
void endiancpy(uint8_t *dest,uint8_t *src,int32_t len)
{
@@ -823,12 +823,12 @@ int64_t TotalPubkeyCCInputs(const CTransaction &tx, const CPubKey &pubkey)
bool ProcessCC(struct CCcontract_info *cp,Eval* eval, std::vector<uint8_t> paramsNull,const CTransaction &ctx, unsigned int nIn)
{
CTransaction createTx; uint256 assetid,assetid2,hashBlock; uint8_t funcid; int32_t height,i,n,from_mempool = 0; int64_t amount; std::vector<uint8_t> origpubkey;
height = KOMODO_CONNECTING;
if ( KOMODO_CONNECTING < 0 ) // always comes back with > 0 for final confirmation
height = HUSH_CONNECTING;
if ( HUSH_CONNECTING < 0 ) // always comes back with > 0 for final confirmation
return(true);
if ( ASSETCHAINS_CC == 0 || (height & ~(1<<30)) < KOMODO_CCACTIVATE )
return eval->Invalid("CC are disabled or not active yet");
if ( (KOMODO_CONNECTING & (1<<30)) != 0 )
if ( (HUSH_CONNECTING & (1<<30)) != 0 )
{
from_mempool = 1;
height &= ((1<<30) - 1);
@@ -836,7 +836,7 @@ bool ProcessCC(struct CCcontract_info *cp,Eval* eval, std::vector<uint8_t> param
if (cp->validate == NULL)
return eval->Invalid("validation not supported for eval code");
//fprintf(stderr,"KOMODO_CONNECTING.%d mempool.%d vs CCactive.%d\n",height,from_mempool,KOMODO_CCACTIVATE);
//fprintf(stderr,"HUSH_CONNECTING.%d mempool.%d vs CCactive.%d\n",height,from_mempool,KOMODO_CCACTIVATE);
// there is a chance CC tx is valid in mempool, but invalid when in block, so we cant filter duplicate requests. if any of the vins are spent, for example
//txid = ctx.GetHash();
//if ( txid == cp->prevtxid )
@@ -869,12 +869,12 @@ bool CClib_Dispatch(const CC *cond,Eval *eval,std::vector<uint8_t> paramsNull,co
fprintf(stderr,"-ac_cclib=%s vs myname %s\n",ASSETCHAINS_CCLIB.c_str(),MYCCLIBNAME.c_str());
return eval->Invalid("-ac_cclib name mismatches myname");
}
height = KOMODO_CONNECTING;
if ( KOMODO_CONNECTING < 0 ) // always comes back with > 0 for final confirmation
height = HUSH_CONNECTING;
if ( HUSH_CONNECTING < 0 ) // always comes back with > 0 for final confirmation
return(true);
if ( ASSETCHAINS_CC == 0 || (height & ~(1<<30)) < KOMODO_CCACTIVATE )
return eval->Invalid("CC are disabled or not active yet");
if ( (KOMODO_CONNECTING & (1<<30)) != 0 )
if ( (HUSH_CONNECTING & (1<<30)) != 0 )
{
from_mempool = 1;
height &= ((1<<30) - 1);