We call them Hush Smart Chains around here

This commit is contained in:
Duke Leto
2020-11-15 11:54:06 -05:00
parent ebf0df633b
commit c737c0dfaf
58 changed files with 422 additions and 421 deletions

View File

@@ -53,7 +53,7 @@
using namespace libzcash;
extern char ASSETCHAINS_SYMBOL[65];
extern char SMART_CHAIN_SYMBOL[65];
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
int32_t komodo_blockheight(uint256 hash);
@@ -333,7 +333,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
}
// for Komodo, set lock time to accure interest, for other chains, set
// locktime to spend time locked coinbases
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
{
if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
builder_.SetLockTime((uint32_t)time(NULL) - 60); // set lock time for Komodo interest
@@ -349,7 +349,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
CTxIn in(COutPoint(txid, vout));
rawTx.vin.push_back(in);
}
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
{
if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777

View File

@@ -59,7 +59,7 @@
using namespace std;
using namespace libzcash;
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
extern std::string ASSETCHAINS_OVERRIDE_PUBKEY;
const std::string ADDR_TYPE_SAPLING = "sapling";
const std::string ADDR_TYPE_AMNESIA = "amnesia";
@@ -172,7 +172,7 @@ string AccountFromValue(const UniValue& value)
char *komodo_chainname()
{
return(ASSETCHAINS_SYMBOL[0] == 0 ? (char *)"KMD" : ASSETCHAINS_SYMBOL);
return(SMART_CHAIN_SYMBOL[0] == 0 ? (char *)"KMD" : SMART_CHAIN_SYMBOL);
}
void OS_randombytes(unsigned char *x,long xlen);
@@ -622,7 +622,7 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
);
if (!EnsureWalletIsAvailable(fHelp))
return 0;
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
return(0);
haveprivkey = 0;
memset(&sig,0,sizeof(sig));
@@ -679,7 +679,7 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
//for (i=0; i<32; i++)
// printf("%02x",((uint8_t *)&sig)[i]);
//printf(" sig for keylen.%d + valuesize.%d\n",keylen,refvaluesize);
ret.push_back(Pair("coin",(char *)(ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)));
ret.push_back(Pair("coin",(char *)(SMART_CHAIN_SYMBOL[0] == 0 ? "KMD" : SMART_CHAIN_SYMBOL)));
height = chainActive.LastTip()->GetHeight();
if ( memcmp(&zeroes,&refpubkey,sizeof(refpubkey)) != 0 )
ret.push_back(Pair("owner",refpubkey.GetHex()));
@@ -780,7 +780,7 @@ UniValue paxdeposit(const UniValue& params, bool fHelp, const CPubKey& mypk)
UniValue paxwithdraw(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
CWalletTx wtx; std::string dest; int32_t kmdheight; uint64_t seed,komodoshis = 0; char destaddr[64]; uint8_t i,pubkey37[37]; bool fSubtractFeeFromAmount = false;
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
return(0);
if (!EnsureWalletIsAvailable(fHelp))
return 0;
@@ -794,14 +794,14 @@ UniValue paxwithdraw(const UniValue& params, bool fHelp, const CPubKey& mypk)
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
int64_t fiatoshis = atof(params[1].get_str().c_str()) * COIN;
komodoshis = PAX_fiatdest(&seed,1,destaddr,pubkey37,(char *)params[0].get_str().c_str(),kmdheight,ASSETCHAINS_SYMBOL,fiatoshis);
komodoshis = PAX_fiatdest(&seed,1,destaddr,pubkey37,(char *)params[0].get_str().c_str(),kmdheight,SMART_CHAIN_SYMBOL,fiatoshis);
dest.append(destaddr);
CBitcoinAddress destaddress(CRYPTO777_KMDADDR);
if (!destaddress.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid dest Bitcoin address");
for (i=0; i<33; i++)
printf("%02x",pubkey37[i]);
printf(" kmdheight.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) komodoshis.%llu seed.%llx\n",kmdheight,(char *)params[0].get_str().c_str(),ASSETCHAINS_SYMBOL,(long long)fiatoshis,destaddr,(long long)komodoshis,(long long)seed);
printf(" kmdheight.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) komodoshis.%llu seed.%llx\n",kmdheight,(char *)params[0].get_str().c_str(),SMART_CHAIN_SYMBOL,(long long)fiatoshis,destaddr,(long long)komodoshis,(long long)seed);
EnsureWalletIsUnlocked();
uint8_t opretbuf[64]; int32_t opretlen; uint64_t fee = fiatoshis / 1000;
if ( fee < 10000 )
@@ -2552,7 +2552,7 @@ UniValue encryptwallet(const UniValue& params, bool fHelp, const CPubKey& mypk)
return NullUniValue;
string enableArg = "developerencryptwallet";
int32_t flag = (komodo_acpublic(0) || ASSETCHAINS_SYMBOL[0] == 0);
int32_t flag = (komodo_acpublic(0) || SMART_CHAIN_SYMBOL[0] == 0);
auto fEnableWalletEncryption = fExperimentalMode && GetBoolArg("-" + enableArg, flag);
std::string strWalletEncryptionDisabledMsg = "";
@@ -2993,7 +2993,7 @@ UniValue listunspent(const UniValue& params, bool fHelp, const CPubKey& mypk)
uint64_t komodo_interestsum()
{
#ifdef ENABLE_WALLET
if ( ASSETCHAINS_SYMBOL[0] == 0 && GetBoolArg("-disablewallet", false) == 0 && KOMODO_NSPV_FULLNODE )
if ( SMART_CHAIN_SYMBOL[0] == 0 && GetBoolArg("-disablewallet", false) == 0 && KOMODO_NSPV_FULLNODE )
{
uint64_t interest,sum = 0; int32_t txheight; uint32_t locktime;
vector<COutput> vecOutputs;

View File

@@ -3245,7 +3245,7 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
if ( KOMODO_EXCHANGEWALLET == 0 )
{
uint32_t locktime; int32_t txheight; CBlockIndex *tipindex;
if ( ASSETCHAINS_SYMBOL[0] == 0 && chainActive.LastTip() != 0 && chainActive.LastTip()->GetHeight() >= 60000 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && chainActive.LastTip() != 0 && chainActive.LastTip()->GetHeight() >= 60000 )
{
if ( pcoin->vout[i].nValue >= 10*COIN )
{
@@ -3747,7 +3747,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
//a chance at a free transaction.
//But mempool inputs might still be in the mempool, so their age stays 0
//fprintf(stderr,"nCredit %.8f interest %.8f\n",(double)nCredit/COIN,(double)pcoin.first->vout[pcoin.second].interest/COIN);
if ( KOMODO_EXCHANGEWALLET == 0 && ASSETCHAINS_SYMBOL[0] == 0 )
if ( KOMODO_EXCHANGEWALLET == 0 && SMART_CHAIN_SYMBOL[0] == 0 )
{
interest2 += pcoin.first->vout[pcoin.second].interest;
//fprintf(stderr,"%.8f ",(double)pcoin.first->vout[pcoin.second].interest/COIN);
@@ -3762,7 +3762,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
//fprintf(stderr,"KOMODO_EXCHANGEWALLET disable interest sum %.8f, interest2 %.8f\n",(double)interest/COIN,(double)interest2/COIN);
//interest = 0; // interest2 also
//}
if ( ASSETCHAINS_SYMBOL[0] == 0 && DONATION_PUBKEY.size() == 66 && interest2 > 5000 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && DONATION_PUBKEY.size() == 66 && interest2 > 5000 )
{
CScript scriptDonation = CScript() << ParseHex(DONATION_PUBKEY) << OP_CHECKSIG;
CTxOut newTxOut(interest2,scriptDonation);
@@ -4799,7 +4799,7 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const
int CMerkleTx::GetBlocksToMaturity() const
{
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
COINBASE_MATURITY = _COINBASE_MATURITY;
if (!IsCoinBase())
return 0;