remove unneeded things

This commit is contained in:
blackjok3r
2018-11-05 15:36:47 +08:00
parent 64c4af2756
commit 068c48214d
4 changed files with 7 additions and 15 deletions

View File

@@ -73,7 +73,6 @@ public:
#include "komodo_structs.h" #include "komodo_structs.h"
#include "komodo_globals.h" #include "komodo_globals.h"
#include "cc/utils.h"
#include "komodo_utils.h" #include "komodo_utils.h"
#include "komodo_cJSON.c" #include "komodo_cJSON.c"
#include "komodo_notary.h" #include "komodo_notary.h"

View File

@@ -287,9 +287,6 @@ extern UniValue FSMlist(const UniValue& params, bool fHelp);
extern UniValue FSMinfo(const UniValue& params, bool fHelp); extern UniValue FSMinfo(const UniValue& params, bool fHelp);
extern UniValue auctionaddress(const UniValue& params, bool fHelp); extern UniValue auctionaddress(const UniValue& params, bool fHelp);
extern bool pubkey2address(char *destaddr,uint8_t *pubkey33);
extern bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey);
extern UniValue getnewaddress(const UniValue& params, bool fHelp); // in rpcwallet.cpp extern UniValue getnewaddress(const UniValue& params, bool fHelp); // in rpcwallet.cpp
//extern UniValue getnewaddress64(const UniValue& params, bool fHelp); // in rpcwallet.cpp //extern UniValue getnewaddress64(const UniValue& params, bool fHelp); // in rpcwallet.cpp
extern UniValue getaccountaddress(const UniValue& params, bool fHelp); extern UniValue getaccountaddress(const UniValue& params, bool fHelp);

View File

@@ -4991,11 +4991,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp)
+ HelpExampleRpc("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") + HelpExampleRpc("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e")
); );
#ifdef ENABLE_WALLET
LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL);
#else
LOCK2(cs_main);
#endif
char Raddress[18]; char Raddress[18];
uint8_t pubkey33[33]; uint8_t pubkey33[33];
@@ -5011,13 +5007,11 @@ UniValue setpubkey(const UniValue& params, bool fHelp)
if (isValid) if (isValid)
{ {
CTxDestination dest = address.Get(); CTxDestination dest = address.Get();
#ifdef ENABLE_WALLET
isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO;
if ( mine == ISMINE_NO ) { if ( mine == ISMINE_NO ) {
result.push_back(Pair("error", "privkey for this pubkey is not imported to wallet!")); result.push_back(Pair("error", "privkey for this pubkey is not imported to wallet!"));
} else { } else {
result.push_back(Pair("ismine", "true")); result.push_back(Pair("ismine", "true"));
#endif
NOTARY_ADDRESS = address.ToString(); NOTARY_ADDRESS = address.ToString();
std::string notaryname; std::string notaryname;
if ( (IS_STAKED_NOTARY= StakedNotaryID(notaryname, Raddress)) > -1 ) { if ( (IS_STAKED_NOTARY= StakedNotaryID(notaryname, Raddress)) > -1 ) {

View File

@@ -1230,7 +1230,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
} }
} }
// Now we know if it was a tx sent to us, that wasnt from ourself. // Now we know if it was a tx sent to us, that wasnt from ourself.
fprintf(stderr, "We sent from address: %s vouts: %d\n",NOTARY_ADDRESS.c_str(),numvinIsOurs); if ( numvinIsOurs != 0 )
fprintf(stderr, "We sent from address: %s vins: %d\n",NOTARY_ADDRESS.c_str(),numvinIsOurs);
// Count vouts, check if OUR notary address is the receiver. // Count vouts, check if OUR notary address is the receiver.
if ( numvinIsOurs == 0 ) { if ( numvinIsOurs == 0 ) {
for (size_t i = 0; i < tx.vout.size() ; i++) { for (size_t i = 0; i < tx.vout.size() ; i++) {
@@ -1244,8 +1245,10 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
} }
} }
// If no vouts are to the notary address we will ignore them. // If no vouts are to the notary address we will ignore them.
if ( numvoutIsOurs == 0 ) if ( numvoutIsOurs == 0 ) {
fprintf(stderr, "Received transaction to address other than notary address, ignored! \n");
return false; return false;
}
fprintf(stderr, "address: %s received %ld sats from %d vouts.\n",NOTARY_ADDRESS.c_str(),totalvoutvalue,numvoutIsOurs); fprintf(stderr, "address: %s received %ld sats from %d vouts.\n",NOTARY_ADDRESS.c_str(),totalvoutvalue,numvoutIsOurs);
// here we add calculation for number if vouts received, average size and determine if we accept them to wallet or not. // here we add calculation for number if vouts received, average size and determine if we accept them to wallet or not.
int64_t avgVoutSize = totalvoutvalue / numvoutIsOurs; int64_t avgVoutSize = totalvoutvalue / numvoutIsOurs;
@@ -1254,10 +1257,9 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
fprintf(stderr, "ignored: %d vouts average size of %ld sats.\n",numvoutIsOurs, avgVoutSize); fprintf(stderr, "ignored: %d vouts average size of %ld sats.\n",numvoutIsOurs, avgVoutSize);
return false; return false;
} }
} else if ( numvinIsOurs < tx.vin.size() ) { } else if ( numvinIsOurs < tx.vin.size() ) {
// this means we were in a multi sig, ideally we would remove the utxo we spent from our wallet, but you cant do that. // this means we were in a multi sig, ideally we would remove the utxo we spent from our wallet, but you cant do that, unless all the tx's vouts are also spent.
// this will be removed later... RPC call PurgeWalletSpents will be created instead. // RPC call PurgeWalletSpents will be created to clean all fully spent tx's instead.
fprintf(stderr, "There are vins that are not ours, notarisation?\n"); fprintf(stderr, "There are vins that are not ours, notarisation?\n");
} }
} }