From 818f6fc43b1db3d7de54a8bd97e649424737093f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 21:15:01 +0800 Subject: [PATCH] dupe --- src/notaries_staked.cpp | 4 +-- src/wallet/rpcwallet.cpp | 70 ++-------------------------------------- 2 files changed, 5 insertions(+), 69 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 3fec522f7..bf59a68b7 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -118,14 +118,14 @@ int is_STAKED(const char *chain_name) { void updateStakedNotary() { std::string notaryname; - pthread_mutex_lock(&komodo_mutex); + //pthread_mutex_lock(&komodo_mutex); if (StakedNotaryID(notaryname,(char *)NOTARY_ADDRESS.c_str()) != -1 ) { IS_STAKED_NOTARY = 1; IS_KOMODO_NOTARY = 0; } else { IS_STAKED_NOTARY = 0; } - pthread_mutex_unlock(&komodo_mutex); + //pthread_mutex_unlock(&komodo_mutex); } int STAKED_era(int timestamp) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a0d88dc48..7e2109329 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4566,7 +4566,7 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33) auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus()); if (!EnsureWalletIsAvailable(0)) return 0; - + const CKeyStore& keystore = *pwalletMain; assert(pwalletMain != NULL); LOCK2(cs_main, pwalletMain->cs_wallet); @@ -4729,7 +4729,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt set setAddress; struct komodo_staking *kp; int32_t winners,segid,minage,nHeight,counter=0,i,m,siglen=0,nMinDepth = 1,nMaxDepth = 99999999; vector vecOutputs; uint32_t block_from_future_rejecttime,besttime,eligible,eligible2,earliest = 0; CScript best_scriptPubKey; arith_uint256 mindiff,ratio,bnTarget; CBlockIndex *tipindex,*pindex; CTxDestination address; bool fNegative,fOverflow; uint8_t hashbuf[256]; CTransaction tx; uint256 hashBlock; if (!EnsureWalletIsAvailable(0)) return 0; - + bnTarget.SetCompact(nBits, &fNegative, &fOverflow); mindiff.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); ratio = (mindiff / bnTarget); @@ -4939,70 +4939,6 @@ UniValue CCaddress(struct CCcontract_info *cp,char *name,std::vectorcs_wallet : NULL); -#else - LOCK(cs_main); -#endif - - char Raddress[18]; - uint8_t pubkey33[33]; - extern uint8_t NOTARY_PUBKEY33[]; - extern std::string NOTARY_PUBKEY; - if ( NOTARY_PUBKEY33[0] == 0 ) { - if (strlen(params[0].get_str().c_str()) == 66) { - decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); - pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); - if (strcmp("RRmWExvapDM9YbLT9X9xAyzDgxomYf63ng",Raddress) == 0) { - result.push_back(Pair("error", "pubkey entered is invalid.")); - } else { - CBitcoinAddress address(Raddress); - bool isValid = address.IsValid(); - if (isValid) - { - CTxDestination dest = address.Get(); - string currentAddress = address.ToString(); - result.push_back(Pair("address", currentAddress)); -#ifdef ENABLE_WALLET - isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; - result.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false)); -#endif - } - NOTARY_PUBKEY = params[0].get_str(); - decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - } - } else { - result.push_back(Pair("error", "pubkey is wrong length, must be 66 char hex string.")); - } - } else { - result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); - } - result.push_back(Pair("pubkey", NOTARY_PUBKEY)); - return result; -} - UniValue channelsaddress(const UniValue& params, bool fHelp) { UniValue result(UniValue::VOBJ); struct CCcontract_info *cp,C; std::vector destpubkey; CPubKey pk,pk2; char destaddr[64]; @@ -6784,7 +6720,7 @@ UniValue getbalance64(const UniValue& params, bool fHelp) UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR),b(UniValue::VARR); CTxDestination address; if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; - + const CKeyStore& keystore = *pwalletMain; CAmount nValues[64],nValues2[64],nValue,total,total2; int32_t i,segid; assert(pwalletMain != NULL);