Skip to content

Commit

Permalink
Merge pull request #64 from cryptogenicbonds/Unstable
Browse files Browse the repository at this point in the history
Unstable
  • Loading branch information
Alex4J authored Sep 2, 2016
2 parents 0b6c4ac + 2ed6e00 commit 65d75b2
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// These need to be macros, as version.cpp's and cryptobullion-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 4
#define CLIENT_VERSION_REVISION 2
#define CLIENT_VERSION_REVISION 3
#define CLIENT_VERSION_BUILD 0

// Copyright year (2009-this)
Expand Down
1 change: 1 addition & 0 deletions src/cryptobullionrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ static const CRPCCommand vRPCCommands[] =
{ "stop", &stop, true, true },
{ "getblockcount", &getblockcount, true, false },
{ "getconnectioncount", &getconnectioncount, true, false },
{ "addnode", &addnode, true, false },
{ "getpeerinfo", &getpeerinfo, true, false },
{ "getdifficulty", &getdifficulty, true, false },
/*{ "getgenerate", &getgenerate, true, false },
Expand Down
1 change: 1 addition & 0 deletions src/cryptobullionrpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ extern std::vector<unsigned char> ParseHexV(const json_spirit::Value& v, std::st
extern std::vector<unsigned char> ParseHexO(const json_spirit::Object& o, std::string strKey);

extern json_spirit::Value getconnectioncount(const json_spirit::Array& params, bool fHelp); // in rpcnet.cpp
extern json_spirit::Value addnode(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getpeerinfo(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value dumpprivkey(const json_spirit::Array& params, bool fHelp); // in rpcdump.cpp
extern json_spirit::Value importprivkey(const json_spirit::Array& params, bool fHelp);
Expand Down
8 changes: 3 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3819,9 +3819,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)


// Update the last seen time for this node's address
if (pfrom->fNetworkNode)
if (pfrom != NULL && pfrom->fNetworkNode)
if (strCommand == "version" || strCommand == "addr" || strCommand == "inv" || strCommand == "getdata" || strCommand == "ping")
AddressCurrentlyConnected(pfrom->addr);
if(pfrom != NULL)
AddressCurrentlyConnected(pfrom->addr);


return true;
Expand Down Expand Up @@ -4629,8 +4630,6 @@ void static ThreadCryptobullionMiner(void* parg);

void CryptobullionMiner(CWallet *pwallet, bool fProofOfStake)
{
void *scratchbuf = scrypt_buffer_alloc();

printf("PoSP Miner Started\n");
SetThreadPriority(THREAD_PRIORITY_LOWEST);

Expand Down Expand Up @@ -4691,5 +4690,4 @@ void CryptobullionMiner(CWallet *pwallet, bool fProofOfStake)
}

free(pFees);
scrypt_buffer_free(scratchbuf);
}
11 changes: 11 additions & 0 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ CCriticalSection cs_setservAddNodeAddresses;

static CSemaphore *semOutbound = NULL;

void AddNewNode(const char *strNewNode){
CAddress addr;
ConnectNode(addr, strNewNode);
}

void AddOneShot(string strDest)
{
LOCK(cs_vOneShots);
Expand Down Expand Up @@ -537,6 +542,7 @@ void CNode::CloseSocketDisconnect()
printf("disconnecting node %s\n", addrName.c_str());
closesocket(hSocket);
hSocket = INVALID_SOCKET;

vRecv.clear();
}
}
Expand Down Expand Up @@ -1471,6 +1477,11 @@ void ThreadOpenAddedConnections2(void* parg)
{
printf("ThreadOpenAddedConnections started\n");

AddNewNode("node.alex4j.cryptobullion.io");
AddNewNode("forum.cryptobullion.io");
AddNewNode("185.69.53.242");
AddNewNode("82.9.77.178");

if (mapArgs.count("-addnode") == 0)
return;

Expand Down
1 change: 1 addition & 0 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern int nBestHeight;
inline unsigned int ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }

void AddNewNode(const char *strNewNode);
void AddOneShot(std::string strDest);
bool RecvLine(SOCKET hSocket, std::string& strLine);
bool GetMyExternalIP(CNetAddr& ipRet);
Expand Down
Binary file modified src/qt/res/images/cbx_newsplash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/rpcnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ static void CopyNodeStats(std::vector<CNodeStats>& vstats)
}
}

Value addnode(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"addnode\n"
"Add new node with the given ip.");

AddNewNode(params[0].get_str().c_str());

Object result;
result.push_back(Pair("response", "Try to add the node"));
return result;
}

Value getpeerinfo(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
Expand Down
6 changes: 3 additions & 3 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1521,14 +1521,14 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int

if (setCoins.empty())
return false;

int64 nCredit = 0;
CScript scriptPubKeyKernel;
CTxDB txdb("r");

BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins)
{
CTxDB txdb("r");
CTxIndex txindex;

if (!txdb.ReadTxIndex(pcoin.first->GetHash(), txindex))
continue;

Expand Down Expand Up @@ -1637,7 +1637,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
&& pcoin.first->GetHash() != txNew.vin[0].prevout.hash)
{
// Stop adding more inputs if already too many inputs
if (txNew.vin.size() >= 100)
if (txNew.vin.size() >= fHardStake ? 100 : 50)
break;
// Stop adding more inputs if value is already pretty significant
if (nCredit > COMBINE_THRESHOLD)
Expand Down

0 comments on commit 65d75b2

Please sign in to comment.