Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Znode #150

Merged
merged 40 commits into from
Dec 13, 2017
Merged

Znode #150

Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f34ec86
Reformat the code. Set constants. Implemented RPC listpubcoins (retur…
sn-ntu Oct 25, 2017
8e4aebe
Initial work for znode
aizensou Nov 3, 2017
0b15c5c
Fix constants at GetNextWork and reset diff at testnet. Fix missing h…
sn-ntu Nov 13, 2017
1f53e32
Correct znodeConfig. Update check conditions
sn-ntu Nov 17, 2017
481ab04
Fix exception for unknown znode command. Add mnsync rpc status. Add s…
sn-ntu Nov 21, 2017
db8769f
Added Znode Build Instructions
sn-ntu Nov 21, 2017
e70b478
znode instruction sec. 4.2 reformat
Nov 22, 2017
5be6cb4
Update README.md
Nov 23, 2017
128ccff
Merge pull request #141 from rainbowstain/znode
Nov 23, 2017
fa8ca56
Private testnet for better debugging. Fix ZnodePaymentStartBlock, fix…
aizensou Nov 25, 2017
1b7b8e9
Fixed LOCAL znode mode. Fix invType for ProcessMessage() MSG_DSTX. Up…
sn-ntu Nov 27, 2017
99e9b11
Update ZNODE.md
Nov 28, 2017
171b2b1
Update ZNODE.md
Nov 28, 2017
245cc6d
Add missing znode inventory. Fix payment and add check coinbase TX
sn-ntu Nov 28, 2017
29255c3
Merge branch 'znode'
psolstice Nov 28, 2017
e0cf157
Add missing znode inventory. Fix payment and add check coinbase TX
sn-ntu Nov 28, 2017
9bf88a0
Added MSG_ZNODE_PAYMENT_BLOCK. Added HasPayeeWithVotes. Added Updated…
sn-ntu Nov 29, 2017
fdd9bdd
Added MSG_ZNODE_PAYMENT_BLOCK. Added HasPayeeWithVotes. Added Updated…
sn-ntu Nov 29, 2017
c9e3ad4
Fixed compilation crash/freeze
psolstice Nov 29, 2017
af59180
Clean debug log and set znode constants
sn-ntu Nov 29, 2017
4737770
Fix conflicts
sn-ntu Nov 29, 2017
839f7be
Updated params for public testnet
sn-ntu Nov 29, 2017
9925cc6
Set ZnodePaymentsStartBlock to 200 for testnet
sn-ntu Nov 30, 2017
a420a23
Changed parallel optimization in libzerocoin from openmp to manual
psolstice Nov 30, 2017
304b90b
change bounty reward to correct address
insomp Nov 30, 2017
8eea376
Cleaned parallel task code for libzerocode
psolstice Dec 1, 2017
16aa2b8
Update getblocktemplate. Refactor mnsync to znsync
sn-ntu Dec 1, 2017
060f590
Removed IDE config files
sn-ntu Dec 1, 2017
776bed2
Final update for public testing
sn-ntu Dec 2, 2017
3d2cc76
Disabled znodeSync condition in RPC getblocktemplate
sn-ntu Dec 2, 2017
7ceec07
Updated params for public testnet
sn-ntu Dec 2, 2017
02bc303
Fix check PayeeValid when Znode payment still isn't active
Dec 2, 2017
27aadcb
Fix founders rewards and znode payment in testnet. Add Znode GUI.
Dec 6, 2017
9114101
Upgrade version to 0.13.4.1. Fixed znode payment checking. Added miss…
sn-ntu Dec 6, 2017
5f1bf4c
Updated znode sync status (GUI). Set default txindex=1
sn-ntu Dec 11, 2017
66ec543
Changed number of mint confirmations to 6
psolstice Dec 12, 2017
357de91
[Mainnet] Introduced HF_ZNODE_HEIGHT=66550 and HF_ZNODE_PAYMENT_START…
sn-ntu Dec 12, 2017
228e927
Merge branch 'znode-6-confirmations' into znode
psolstice Dec 13, 2017
c671f87
Fixed missing lock acquisition
psolstice Dec 13, 2017
4636f14
Updated REJECT message when the peer version is less than MIN_PEER_PR…
sn-ntu Dec 13, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/activeznode.cpp
Original file line number Diff line number Diff line change
@@ -233,9 +233,9 @@ void CActiveZnode::ManageStateInitial() {
CKey keyCollateral;

// If collateral is found switch to LOCAL mode
if (pwalletMain->GetZnodeVinAndKeys(vin, pubKeyCollateral, keyCollateral)) {
eType = ZNODE_LOCAL;
}
// if (pwalletMain->GetZnodeVinAndKeys(vin, pubKeyCollateral, keyCollateral)) {
// eType = ZNODE_LOCAL;
// }

LogPrint("znode", "CActiveZnode::ManageStateInitial -- End status = %s, type = %s, pinger enabled = %d\n",
GetStatus(), GetTypeString(), fPingerEnabled);
@@ -326,6 +326,6 @@ void CActiveZnode::ManageStateLocal() {

//send to all peers
LogPrintf("CActiveZnode::ManageStateLocal -- Relay broadcast, vin=%s\n", vin.ToString());
mnb.Relay();
mnb.RelayZNode();
}
}
6 changes: 3 additions & 3 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
@@ -248,9 +248,9 @@ class CTestNetParams : public CChainParams {
// The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000708f98bf623f02e");
// Znode params testnet
consensus.nZnodePaymentsStartBlock = 100; // not true, but it's ok as long as it's less then n
consensus.nZnodePaymentsIncreaseBlock = 110;
consensus.nZnodePaymentsIncreasePeriod = 576;
consensus.nZnodePaymentsStartBlock = 640; // not true, but it's ok as long as it's less then n
consensus.nZnodePaymentsIncreaseBlock = 640;
consensus.nZnodePaymentsIncreasePeriod = 650;
consensus.nSuperblockStartBlock = 61000;
consensus.nBudgetPaymentsStartBlock = 60000;
consensus.nBudgetPaymentsCycleBlocks = 50;
3 changes: 2 additions & 1 deletion src/darksend.cpp
Original file line number Diff line number Diff line change
@@ -1244,7 +1244,8 @@ bool CDarksendPool::SignFinalTransaction(const CTransaction &finalTransactionNew
const CKeyStore &keystore = *pwalletMain;

LogPrint("privatesend", "CDarksendPool::SignFinalTransaction -- Signing my input %i\n", nMyInputIndex);
if (!SignSignature(keystore, prevPubKey, finalMutableTransaction, nMyInputIndex, NULL, int(SIGHASH_ALL | SIGHASH_ANYONECANPAY))) { // changes scriptSig
CAmount amount;
if (!SignSignature(keystore, prevPubKey, finalMutableTransaction, nMyInputIndex, amount, int(SIGHASH_ALL | SIGHASH_ANYONECANPAY))) { // changes scriptSig
LogPrint("privatesend", "CDarksendPool::SignFinalTransaction -- Unable to sign my own transaction!\n");
// not sure what to do here, it will timeout...?
}
8 changes: 5 additions & 3 deletions src/init.cpp
Original file line number Diff line number Diff line change
@@ -757,7 +757,8 @@ void ThreadImport(std::vector <boost::filesystem::path> vImportFiles) {
}

// -loadblock=
BOOST_FOREACH(const boost::filesystem::path &path, vImportFiles) {
BOOST_FOREACH(
const boost::filesystem::path &path, vImportFiles) {
FILE *file = fopen(path.string().c_str(), "rb");
if (file) {
LogPrintf("Importing blocks file %s...\n", path.string());
@@ -1708,7 +1709,8 @@ bool AppInit2(boost::thread_group &threadGroup, CScheduler &scheduler) {
LogPrintf("Locking Znodes:\n");
uint256 mnTxHash;
int outputIndex;
BOOST_FOREACH(CZnodeConfig::CZnodeEntry mne, znodeConfig.getEntries()) {
BOOST_FOREACH(CZnodeConfig::CZnodeEntry
mne, znodeConfig.getEntries()) {
mnTxHash.SetHex(mne.getTxHash());
outputIndex = boost::lexical_cast<unsigned int>(mne.getOutputIndex());
COutPoint outpoint = COutPoint(mnTxHash, outputIndex);
@@ -1781,7 +1783,7 @@ bool AppInit2(boost::thread_group &threadGroup, CScheduler &scheduler) {

// force UpdatedBlockTip to initialize pCurrentBlockIndex for DS, MN payments and budgets
// but don't call it directly to prevent triggering of other listeners like zmq etc.
// GetMainSignals().UpdatedBlockTip(chainActive.Tip());
// GetMainSignals().UpdatedBlockTip(chainActive.Tip());
mnodeman.UpdatedBlockTip(chainActive.Tip());
darkSendPool.UpdatedBlockTip(chainActive.Tip());
mnpayments.UpdatedBlockTip(chainActive.Tip());
292 changes: 171 additions & 121 deletions src/main.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/main.h
Original file line number Diff line number Diff line change
@@ -91,6 +91,7 @@ static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 50000; // 50KB
/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
static const int64_t DUST_HARD_LIMIT = 1000; // 0.00001 XZC mininput


/** Maximum number of script-checking threads allowed */
static const int MAX_SCRIPTCHECK_THREADS = 16;
/** -par default (number of script-checking threads, 0 = auto) */
208 changes: 70 additions & 138 deletions src/miner.cpp
Original file line number Diff line number Diff line change
@@ -140,54 +140,85 @@ CBlockTemplate* BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)
return NULL;
CBlock *pblock = &pblocktemplate->block; // pointer for convenience
// Create coinbase tx
CMutableTransaction txNew;
txNew.vin.resize(1);
txNew.vin[0].prevout.SetNull();
txNew.vout.resize(1);
txNew.vout[0].scriptPubKey = scriptPubKeyIn;
txNew.vout[0].nValue = 0;
CMutableTransaction coinbaseTx;
coinbaseTx.vin.resize(1);
coinbaseTx.vin[0].prevout.SetNull();
coinbaseTx.vout.resize(1);
coinbaseTx.vout[0].scriptPubKey = scriptPubKeyIn;
coinbaseTx.vout[0].nValue = 0;
CBlockIndex* pindexPrev = chainActive.Tip();
const int nHeight = pindexPrev->nHeight + 1;
// To founders and investors
if ((nHeight > 0) && (nHeight < 210000)) {
// Take some reward away from us
txNew.vout[0].nValue = -10 * COIN;

// To founders and investors
if ((nHeight + 1 > 0) && (nHeight + 1 < 210000)) {
CScript FOUNDER_1_SCRIPT;
CScript FOUNDER_2_SCRIPT;
CScript FOUNDER_3_SCRIPT;
CScript FOUNDER_4_SCRIPT;
CScript FOUNDER_5_SCRIPT;
if (nHeight < Params().GetConsensus().nZnodePaymentsStartBlock) {
// Take some reward away from us
coinbaseTx.vout[0].nValue = -10 * COIN;

if (!fTestNet && (GetAdjustedTime() > nStartRewardTime)) {
FOUNDER_1_SCRIPT = GetScriptForDestination(CBitcoinAddress("aCAgTPgtYcA4EysU4UKC86EQd5cTtHtCcr").Get());
if (nHeight + 1 < 14000) {
FOUNDER_2_SCRIPT = GetScriptForDestination(CBitcoinAddress("aLrg41sXbXZc5MyEj7dts8upZKSAtJmRDR").Get());
} else {
FOUNDER_2_SCRIPT = GetScriptForDestination(CBitcoinAddress("aHu897ivzmeFuLNB6956X6gyGeVNHUBRgD").Get());
}
FOUNDER_3_SCRIPT = GetScriptForDestination(CBitcoinAddress("aQ18FBVFtnueucZKeVg4srhmzbpAeb1KoN").Get());
FOUNDER_4_SCRIPT = GetScriptForDestination(CBitcoinAddress("a1HwTdCmQV3NspP2QqCGpehoFpi8NY4Zg3").Get());
FOUNDER_5_SCRIPT = GetScriptForDestination(CBitcoinAddress("a1kCCGddf5pMXSipLVD9hBG2MGGVNaJ15U").Get());
} else if (!fTestNet && (GetAdjustedTime() <= nStartRewardTime)) {
throw std::runtime_error("CreateNewBlock() : Create new block too early");
} else if (fTestNet) {
FOUNDER_1_SCRIPT = GetScriptForDestination(CBitcoinAddress("TCE4hvs2UTDjYriey7R9qBkbvUAYxWmZni").Get());
FOUNDER_2_SCRIPT = GetScriptForDestination(CBitcoinAddress("TPyA7d3fribqxXm9uJU61S76Lzuj7F8jLz").Get());
FOUNDER_3_SCRIPT = GetScriptForDestination(CBitcoinAddress("TXatvpS15EvejVuJVC2rgD73rSaQz8JiX6").Get());
FOUNDER_4_SCRIPT = GetScriptForDestination(CBitcoinAddress("TJMpFjtDi8s5AM3GyW41QshH2NNmKgrGNq").Get());
FOUNDER_5_SCRIPT = GetScriptForDestination(CBitcoinAddress("TTtLk1iapn8QebamQcb8GEh1MNq8agYcVk").Get());
}

if (!fTestNet && (GetAdjustedTime() > nStartRewardTime)) {
FOUNDER_1_SCRIPT = GetScriptForDestination(CBitcoinAddress("aCAgTPgtYcA4EysU4UKC86EQd5cTtHtCcr").Get());
if (nHeight < 14000) {
FOUNDER_2_SCRIPT = GetScriptForDestination(CBitcoinAddress("aLrg41sXbXZc5MyEj7dts8upZKSAtJmRDR").Get());
} else {
FOUNDER_2_SCRIPT = GetScriptForDestination(CBitcoinAddress("aHu897ivzmeFuLNB6956X6gyGeVNHUBRgD").Get());
// And give it to the founders
coinbaseTx.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_1_SCRIPT.begin(), FOUNDER_1_SCRIPT.end())));
coinbaseTx.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_2_SCRIPT.begin(), FOUNDER_2_SCRIPT.end())));
coinbaseTx.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_3_SCRIPT.begin(), FOUNDER_3_SCRIPT.end())));
coinbaseTx.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_4_SCRIPT.begin(), FOUNDER_4_SCRIPT.end())));
coinbaseTx.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_5_SCRIPT.begin(), FOUNDER_5_SCRIPT.end())));
} else if (nHeight >= Params().GetConsensus().nZnodePaymentsStartBlock) {
// Take some reward away from us
coinbaseTx.vout[0].nValue = -7 * COIN;

if (!fTestNet && (GetAdjustedTime() > nStartRewardTime)) {
FOUNDER_1_SCRIPT = GetScriptForDestination(CBitcoinAddress("aCAgTPgtYcA4EysU4UKC86EQd5cTtHtCcr").Get());
if (nHeight + 1 < 14000) {
FOUNDER_2_SCRIPT = GetScriptForDestination(CBitcoinAddress("aLrg41sXbXZc5MyEj7dts8upZKSAtJmRDR").Get());
} else {
FOUNDER_2_SCRIPT = GetScriptForDestination(CBitcoinAddress("aHu897ivzmeFuLNB6956X6gyGeVNHUBRgD").Get());
}
FOUNDER_3_SCRIPT = GetScriptForDestination(CBitcoinAddress("aQ18FBVFtnueucZKeVg4srhmzbpAeb1KoN").Get());
FOUNDER_4_SCRIPT = GetScriptForDestination(CBitcoinAddress("a1HwTdCmQV3NspP2QqCGpehoFpi8NY4Zg3").Get());
FOUNDER_5_SCRIPT = GetScriptForDestination(CBitcoinAddress("a1kCCGddf5pMXSipLVD9hBG2MGGVNaJ15U").Get());
} else if (!fTestNet && (GetAdjustedTime() <= nStartRewardTime)) {
throw std::runtime_error("CreateNewBlock() : Create new block too early");
} else if (fTestNet) {
FOUNDER_1_SCRIPT = GetScriptForDestination(CBitcoinAddress("TCE4hvs2UTDjYriey7R9qBkbvUAYxWmZni").Get());
FOUNDER_2_SCRIPT = GetScriptForDestination(CBitcoinAddress("TPyA7d3fribqxXm9uJU61S76Lzuj7F8jLz").Get());
FOUNDER_3_SCRIPT = GetScriptForDestination(CBitcoinAddress("TXatvpS15EvejVuJVC2rgD73rSaQz8JiX6").Get());
FOUNDER_4_SCRIPT = GetScriptForDestination(CBitcoinAddress("TJMpFjtDi8s5AM3GyW41QshH2NNmKgrGNq").Get());
FOUNDER_5_SCRIPT = GetScriptForDestination(CBitcoinAddress("TTtLk1iapn8QebamQcb8GEh1MNq8agYcVk").Get());
}
FOUNDER_3_SCRIPT = GetScriptForDestination(CBitcoinAddress("aQ18FBVFtnueucZKeVg4srhmzbpAeb1KoN").Get());
FOUNDER_4_SCRIPT = GetScriptForDestination(CBitcoinAddress("a1HwTdCmQV3NspP2QqCGpehoFpi8NY4Zg3").Get());
FOUNDER_5_SCRIPT = GetScriptForDestination(CBitcoinAddress("a1kCCGddf5pMXSipLVD9hBG2MGGVNaJ15U").Get());
} else if (!fTestNet && (GetAdjustedTime() <= nStartRewardTime)) {
throw std::runtime_error("CreateNewBlock() : Create new block too early");
} else {
FOUNDER_1_SCRIPT = GetScriptForDestination(CBitcoinAddress("TCE4hvs2UTDjYriey7R9qBkbvUAYxWmZni").Get());
FOUNDER_2_SCRIPT = GetScriptForDestination(CBitcoinAddress("TPyA7d3fribqxXm9uJU61S76Lzuj7F8jLz").Get());
FOUNDER_3_SCRIPT = GetScriptForDestination(CBitcoinAddress("TXatvpS15EvejVuJVC2rgD73rSaQz8JiX6").Get());
FOUNDER_4_SCRIPT = GetScriptForDestination(CBitcoinAddress("TJMpFjtDi8s5AM3GyW41QshH2NNmKgrGNq").Get());
FOUNDER_5_SCRIPT = GetScriptForDestination(CBitcoinAddress("TTtLk1iapn8QebamQcb8GEh1MNq8agYcVk").Get());
}

// And give it to the founders
txNew.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_1_SCRIPT.begin(), FOUNDER_1_SCRIPT.end())));
txNew.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_2_SCRIPT.begin(), FOUNDER_2_SCRIPT.end())));
txNew.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_3_SCRIPT.begin(), FOUNDER_3_SCRIPT.end())));
txNew.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_4_SCRIPT.begin(), FOUNDER_4_SCRIPT.end())));
txNew.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_5_SCRIPT.begin(), FOUNDER_5_SCRIPT.end())));
// And give it to the founders
coinbaseTx.vout.push_back(CTxOut(1 * COIN, CScript(FOUNDER_1_SCRIPT.begin(), FOUNDER_1_SCRIPT.end())));
coinbaseTx.vout.push_back(CTxOut(1 * COIN, CScript(FOUNDER_2_SCRIPT.begin(), FOUNDER_2_SCRIPT.end())));
coinbaseTx.vout.push_back(CTxOut(1 * COIN, CScript(FOUNDER_3_SCRIPT.begin(), FOUNDER_3_SCRIPT.end())));
coinbaseTx.vout.push_back(CTxOut(1 * COIN, CScript(FOUNDER_4_SCRIPT.begin(), FOUNDER_4_SCRIPT.end())));
coinbaseTx.vout.push_back(CTxOut(3 * COIN, CScript(FOUNDER_5_SCRIPT.begin(), FOUNDER_5_SCRIPT.end())));
}
}


// Add dummy coinbase tx as first transaction
pblock->vtx.push_back(CTransaction());
pblocktemplate->vTxFees.push_back(-1); // updated at end
@@ -454,17 +485,17 @@ CBlockTemplate* BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)
// Update coinbase transaction with additional info about masternode and governance payments,
// get some info back to pass to getblocktemplate
if (nHeight >= chainparams.GetConsensus().nZnodePaymentsStartBlock) {
FillBlockPayments(txNew, nHeight, blockReward, pblock->txoutZnode, pblock->voutSuperblock);
FillBlockPayments(coinbaseTx, nHeight, blockReward, pblock->txoutZnode, pblock->voutSuperblock);
}

nLastBlockTx = nBlockTx;
nLastBlockSize = nBlockSize;
LogPrintf("CreateNewBlock(): total size %u txs: %u fees: %ld sigops %d\n", nBlockSize, nBlockTx, nFees, nBlockSigOps);

// Compute final coinbase transaction.
txNew.vout[0].nValue += blockReward;
txNew.vin[0].scriptSig = CScript() << nHeight << OP_0;
pblock->vtx[0] = txNew;
coinbaseTx.vout[0].nValue += blockReward;
coinbaseTx.vin[0].scriptSig = CScript() << nHeight << OP_0;
pblock->vtx[0] = coinbaseTx;
pblocktemplate->vTxFees[0] = -nFees;

// Fill in header
@@ -482,105 +513,6 @@ CBlockTemplate* BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)
return pblocktemplate.release();
}

CBlockTemplate* BlockAssembler::CreateNewBlock_(const CScript& scriptPubKeyIn)
{
LogPrintf("BlockAssembler::CreateNewBlock()\n");
bool fTestNet = (Params().NetworkIDString() == CBaseChainParams::TESTNET);
resetBlock();
pblocktemplate.reset(new CBlockTemplate());
if(!pblocktemplate.get())
return NULL;
pblock = &pblocktemplate->block; // pointer for convenience

CBlockIndex* pindexPrev = chainActive.Tip();
nHeight = pindexPrev->nHeight;

CTransaction coinbaseTx;
coinbaseTx.vin.resize(1);
coinbaseTx.vin[0].prevout.SetNull();
coinbaseTx.vout.resize(1);
coinbaseTx.vout[0].scriptPubKey = scriptPubKeyIn;
coinbaseTx.vout[0].nValue = 0;

// To founders and investors
if ((nHeight + 1> 0) && (nHeight + 1 < 210000)) {
// Take some reward away from us
coinbaseTx.vout[0].nValue = -10 * COIN;

CScript FOUNDER_1_SCRIPT;
CScript FOUNDER_2_SCRIPT;
CScript FOUNDER_3_SCRIPT;
CScript FOUNDER_4_SCRIPT;
CScript FOUNDER_5_SCRIPT;

if (!fTestNet && (GetAdjustedTime() > nStartRewardTime)) {
FOUNDER_1_SCRIPT = GetScriptForDestination(CBitcoinAddress("aCAgTPgtYcA4EysU4UKC86EQd5cTtHtCcr").Get());
if (nHeight + 1 < 14000) {
FOUNDER_2_SCRIPT = GetScriptForDestination(CBitcoinAddress("aLrg41sXbXZc5MyEj7dts8upZKSAtJmRDR").Get());
} else {
FOUNDER_2_SCRIPT = GetScriptForDestination(CBitcoinAddress("aHu897ivzmeFuLNB6956X6gyGeVNHUBRgD").Get());
}
FOUNDER_3_SCRIPT = GetScriptForDestination(CBitcoinAddress("aQ18FBVFtnueucZKeVg4srhmzbpAeb1KoN").Get());
FOUNDER_4_SCRIPT = GetScriptForDestination(CBitcoinAddress("a1HwTdCmQV3NspP2QqCGpehoFpi8NY4Zg3").Get());
FOUNDER_5_SCRIPT = GetScriptForDestination(CBitcoinAddress("a1kCCGddf5pMXSipLVD9hBG2MGGVNaJ15U").Get());
} else if (!fTestNet && (GetAdjustedTime() <= nStartRewardTime)) {
throw std::runtime_error("CreateNewBlock() : Create new block too early");
} else {
FOUNDER_1_SCRIPT = GetScriptForDestination(CBitcoinAddress("TCE4hvs2UTDjYriey7R9qBkbvUAYxWmZni").Get());
FOUNDER_2_SCRIPT = GetScriptForDestination(CBitcoinAddress("TPyA7d3fribqxXm9uJU61S76Lzuj7F8jLz").Get());
FOUNDER_3_SCRIPT = GetScriptForDestination(CBitcoinAddress("TXatvpS15EvejVuJVC2rgD73rSaQz8JiX6").Get());
FOUNDER_4_SCRIPT = GetScriptForDestination(CBitcoinAddress("TJMpFjtDi8s5AM3GyW41QshH2NNmKgrGNq").Get());
FOUNDER_5_SCRIPT = GetScriptForDestination(CBitcoinAddress("TTtLk1iapn8QebamQcb8GEh1MNq8agYcVk").Get());
}

// And give it to the founders
coinbaseTx.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_1_SCRIPT.begin(), FOUNDER_1_SCRIPT.end())));
coinbaseTx.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_2_SCRIPT.begin(), FOUNDER_2_SCRIPT.end())));
coinbaseTx.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_3_SCRIPT.begin(), FOUNDER_3_SCRIPT.end())));
coinbaseTx.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_4_SCRIPT.begin(), FOUNDER_4_SCRIPT.end())));
coinbaseTx.vout.push_back(CTxOut(2 * COIN, CScript(FOUNDER_5_SCRIPT.begin(), FOUNDER_5_SCRIPT.end())));
}

// Add dummy coinbase tx as first transaction
pblock->vtx.push_back(coinbaseTx);
pblocktemplate->vTxFees.push_back(-1); // updated at end
pblocktemplate->vTxSigOpsCost.push_back(-1); // updated at end
// pblocktemplate->vchCoinbaseCommitment = GenerateCoinbaseCommitment(*pblock, pindexPrev, chainparams.GetConsensus());
pblocktemplate->vTxFees[0] = -nFees;
GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION);

LOCK2(cs_main, mempool.cs);
// pblock->nVersion = ComputeBlockVersion(pindexPrev, chainparams.GetConsensus());
// if (chainparams.MineBlocksOnDemand())
// pblock->nVersion = GetArg("-blockversion", pblock->nVersion);
pblock->nTime = GetAdjustedTime();
const int64_t nMedianTimePast = pindexPrev->GetMedianTimePast();
nLockTimeCutoff = (STANDARD_LOCKTIME_VERIFY_FLAGS & LOCKTIME_MEDIAN_TIME_PAST) ? nMedianTimePast : pblock->GetBlockTime();
fIncludeWitness = IsWitnessEnabled(pindexPrev, chainparams.GetConsensus());

addPriorityTxs();
addPackageTxs();

nLastBlockTx = nBlockTx;
nLastBlockSize = nBlockSize;
nLastBlockWeight = nBlockWeight;

// Fill in header
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev);
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, chainparams.GetConsensus());
pblock->nNonce = 0;
pblock->vtx[0].vin[0].scriptSig = CScript() << OP_0 << OP_0;
CScript expect = CScript() << nHeight;
pblock->vtx[0].vout[0].nValue += nFees + GetBlockSubsidy(nHeight, chainparams.GetConsensus(), pblock->nTime);
pblocktemplate->vTxSigOpsCost[0] = GetLegacySigOpCount(pblock->vtx[0]);
CValidationState state;
if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, false)) {
throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", __func__, FormatStateMessage(state)));
}
return pblocktemplate.release();
}


CBlockTemplate* BlockAssembler::CreateNewBlockWithKey(CReserveKey &reservekey) {
LogPrintf("CreateNewBlockWithKey()\n");
1 change: 1 addition & 0 deletions src/net.cpp
Original file line number Diff line number Diff line change
@@ -2099,6 +2099,7 @@ void RelayTransaction(const CTransaction &tx) {

void RelayInv(CInv &inv, const int minProtoVersion) {
LOCK(cs_vNodes);
LogPrintf("RelayInv, vNodes.size()=%s\n", vNodes.size());
BOOST_FOREACH(CNode * pnode, vNodes)
{
if (pnode->nVersion >= minProtoVersion)
Loading