Skip to content

Commit

Permalink
lot of small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
szabozee committed Mar 12, 2017
1 parent 44bf667 commit 7a3a883
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 121 deletions.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ int64_t GetProofOfWorkReward(int64_t nFees)
{
int64_t nSubsidy = 0 * COIN;
// Premine 650.000.000 coins
if(pindexBest->nHeight <= 650)
if(pindexBest->nHeight < 650)
{
nSubsidy = 1000000 * COIN; // ICO Premine
}
Expand Down
1 change: 1 addition & 0 deletions src/makefile.unix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

STATIC:=1
USE_UPNP:=0
USE_IPV6:=1

Expand Down
107 changes: 29 additions & 78 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake, int64_t* pFees)
char* targetAddress;

// FIXMEE!
if ( nBestHeight < 5 ) {
if ( nBestHeight < 650 ) {
targetAddress = (char*)ICO_TARGET_ADDRESS;
} else {
targetAddress = (char*)POSIGN_FEE_ADDRESS;
Expand Down Expand Up @@ -546,9 +546,8 @@ bool CheckStake(CBlock* pblock, CWallet& wallet)


const char* POSIGN_FEE_ADDRESS="BLocksFEE4ProofofSignatureXXYF3VQ3";
// const char* ICO_TARGET_ADDRESS="BGVUg2AzNEd3T28zQBNG2v8hzqbC3bDoDf"; // C-CEX
// FIXME!
const char* ICO_TARGET_ADDRESS="BMjog598wULrLmwx9AboMYkHgAfYVNgQJq"; // ICO Testing
const char* ICO_TARGET_ADDRESS="BGVUg2AzNEd3T28zQBNG2v8hzqbC3bDoDf"; // C-CEX
extern unsigned int nTargetSpacing;

void SignatureMiner(CWallet *pwallet)
{
Expand All @@ -565,89 +564,41 @@ void SignatureMiner(CWallet *pwallet)

if (fTryToSync) {
fTryToSync = false;
// FIXMEE! unsigned expression < 0 is always false
if (vNodes.size() < 0 || nBestHeight < GetNumBlocksOfPeers())
{
MilliSleep(3000);
continue;
}
}

int64_t nFees = -1;
auto_ptr<CBlock> pblock(CreateNewBlock( NULL , NULL , &nFees ));
//auto_ptr<CBlock> pblock(CreateNewBlock( NULL , NULL , NULL ));
if (pblock.get()) {
std::cout << "New block created." << std::endl;
} else {
std::cout << "New block creating fail." << std::endl;
}



// Trying to sign a block
if (pblock->SignPoSignBlock(nFees))
{
SetThreadPriority(THREAD_PRIORITY_NORMAL);
// CheckStake(pblock.get(), *pwallet);
SetThreadPriority(THREAD_PRIORITY_LOWEST);
MilliSleep(500);

if ((GetAdjustedTime() - pindexBest->GetBlockTime()) > ( nTargetSpacing * 2 )) {

int64_t nFees = -1;
auto_ptr<CBlock> pblock(CreateNewBlock( NULL , NULL , &nFees ));


if (pblock.get()) {
// Trying to sign a block
if (pblock->SignPoSignBlock(nFees))
{
// Process this block the same as if we had received it from another node
if (!ProcessBlock(NULL, pblock.get())) {
// process fail
}

} else {
// sign fail
}
} else {
// New block fail.
}
}
else
MilliSleep(nMinerSleep);


fPrintToConsole = true;
pblock->print();
fflush(stdout);

// Process this block the same as if we had received it from another node
if (!ProcessBlock(NULL, pblock.get()))
std::cout << "Proof of Signature process : ProcessBlock, block not accepted" << std::endl;


// Trying to sign a block
// if (pblock->SignBlock(*pwallet, nFees))

/*
//
// Create new block
//
std::cout << "Try to mine a block." << std::endl;

CBlockIndex* pindexPrev = pindexBest;
auto_ptr<CBlock> pblock(new CBlock());
if (pblock.get()) {
std::cout << "New block created." << std::endl;

// Create coinbase tx
CTransaction txNew;
txNew.vin.resize(1);
txNew.vin[0].prevout.SetNull();
txNew.vout.resize(1);
//txNew.vin[0].scriptSig = (CScript() << pindexPrev->nHeight+1) + COINBASE_FLAGS;
txNew.vin[0].scriptSig = (CScript() << 1) + COINBASE_FLAGS;
assert(txNew.vin[0].scriptSig.size() <= 100);
txNew.vout[0].SetEmpty();
pblock->vtx.push_back(txNew);

uint256 valami = pindexPrev->GetBlockHash();
pblock->hashPrevBlock = valami;

fPrintToConsole = true;
pblock->print();
fflush(stdout);

if (mapArgs.count("-posigkey")) {
std::cout << "Proof of Signature Key:" << GetArg("-posigkey", "") << std::endl;
}

} // no block created
std::cout << "Just exit." << std::endl << std::endl << std::endl;
*/

MilliSleep(10000);

MilliSleep(nMinerSleep);
}
MilliSleep(nMinerSleep);

} // while
}

void StakeMiner(CWallet *pwallet)
Expand Down
8 changes: 4 additions & 4 deletions src/qt/blockbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ std::string getOutputs(std::string txid)
str.append(lol7);
str.append(": ");
str.append(amount);
str.append(" GNJ");
str.append(" XBY");
str.append("\n");
}

Expand Down Expand Up @@ -254,7 +254,7 @@ std::string getInputs(std::string txid)
str.append(lol6);
str.append(": ");
str.append(amount);
str.append("GNJ");
str.append("XBY");
str.append("\n");
}

Expand Down Expand Up @@ -406,11 +406,11 @@ void BlockBrowser::updateExplorer(bool block)
QString QOutputs = QString::fromUtf8(outputs.c_str());
QString QInputs = QString::fromUtf8(inputs.c_str());
QString QFees = QString::number(fees, 'f', 6);
ui->valueBox->setText(QValue + " GNJ");
ui->valueBox->setText(QValue + " XBY");
ui->txID->setText(QID);
ui->outputBox->setText(QOutputs);
ui->inputBox->setText(QInputs);
ui->feesBox->setText(QFees + " GNJ");
ui->feesBox->setText(QFees + " XBY");
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/qt/forms/coincontroldialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="text">
<string notr="true">0.00 GNJ</string>
<string notr="true">0.00 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -221,7 +221,7 @@
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="text">
<string notr="true">0.00 GNJ</string>
<string notr="true">0.00 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -307,7 +307,7 @@
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="text">
<string notr="true">0.00 GNJ</string>
<string notr="true">0.00 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -345,7 +345,7 @@
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="text">
<string notr="true">0.00 GNJ</string>
<string notr="true">0.00 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down
10 changes: 5 additions & 5 deletions src/qt/forms/overviewpage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<string>Your current spendable balance</string>
</property>
<property name="text">
<string notr="true">0 GNJ</string>
<string notr="true">0 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -134,7 +134,7 @@
<string>Total of coins that was staked, and do not yet count toward the current balance</string>
</property>
<property name="text">
<string notr="true">0 GNJ</string>
<string notr="true">0 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -163,7 +163,7 @@
<string>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</string>
</property>
<property name="text">
<string notr="true">0 GNJ</string>
<string notr="true">0 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand All @@ -189,7 +189,7 @@
<string>Mined balance that has not yet matured</string>
</property>
<property name="text">
<string notr="true">0 GNJ</string>
<string notr="true">0 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -225,7 +225,7 @@
<string>Your current total balance</string>
</property>
<property name="text">
<string notr="true">0 GNJ</string>
<string notr="true">0 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down
10 changes: 5 additions & 5 deletions src/qt/forms/sendcoinsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="text">
<string>0.00 GNJ</string>
<string>0.00 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -407,7 +407,7 @@
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="text">
<string>0.00 GNJ</string>
<string>0.00 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -493,7 +493,7 @@
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="text">
<string>0.00 GNJ</string>
<string>0.00 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -525,7 +525,7 @@
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="text">
<string>0.00 GNJ</string>
<string>0.00 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -732,7 +732,7 @@
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>123.456 GNJ</string>
<string>123.456 XBY</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
Expand Down
Binary file modified src/qt/res/images/about.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/qt/res/images/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 8 additions & 23 deletions src/qt/statisticspage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,29 +61,14 @@ void StatisticsPage::updateStatistics()
}

QString subsidy = "";
if(pindexBest->nHeight < 250)
{
subsidy = "0 GNJ";
}
else if(pindexBest->nHeight < 1500)
{
subsidy = "100 GNJ";
}
else if(pindexBest->nHeight < 3100)
{
subsidy = "200 GNJ";
}
else if(pindexBest->nHeight < 4650)
{
subsidy = "250 GNJ";
}
else if(pindexBest->nHeight < 7200)

if(pindexBest->nHeight < 650)
{
subsidy = "100 GNJ";
subsidy = "1000000 XBY";
}
else if(pindexBest->nHeight < 10300)
else
{
subsidy = "50 GNJ";
subsidy = "0 XBY";
}

QString hardness = QString::number(pHardness, 'f', 6);
Expand Down Expand Up @@ -173,11 +158,11 @@ void StatisticsPage::updateStatistics()

if(volume > volumePrevious)
{
ui->volumeBox->setText("<b><font color=\"green\">" + qVolume + " GNJ" + "</font></b>");
ui->volumeBox->setText("<b><font color=\"green\">" + qVolume + " XBY" + "</font></b>");
} else if(volume < volumePrevious) {
ui->volumeBox->setText("<b><font color=\"red\">" + qVolume + " GNJ" + "</font></b>");
ui->volumeBox->setText("<b><font color=\"red\">" + qVolume + " XBY" + "</font></b>");
} else {
ui->volumeBox->setText(qVolume + " GNJ");
ui->volumeBox->setText(qVolume + " XBY");
}
updatePrevious(nHeight, nMinWeight, nNetworkWeight, phase, subsidy, pHardness, pHardness2, pPawrate2, Qlpawrate, peers, volume);
}
Expand Down
2 changes: 1 addition & 1 deletion src/rpcmining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ Value getworkex(const Array& params, bool fHelp)
if(coinbase.size() == 0)
pblock->vtx[0].vin[0].scriptSig = mapNewBlock[pdata->hashMerkleRoot].second;
else
CDataStream(coinbase, SER_NETWORK, PROTOCOL_VERSION) >> pblock->vtx[0]; // FIXME - GNJ!
CDataStream(coinbase, SER_NETWORK, PROTOCOL_VERSION) >> pblock->vtx[0];

pblock->hashMerkleRoot = pblock->BuildMerkleTree();

Expand Down

0 comments on commit 7a3a883

Please sign in to comment.