Skip to content

Commit

Permalink
Merged in masternodes (pull request ioncoincore#13)
Browse files Browse the repository at this point in the history
Masternodes and staking after DIP0003 activation

Approved-by: Cevap
  • Loading branch information
FornaxA authored and Cevap committed Feb 12, 2020
2 parents da47513 + d004515 commit ecc43c7
Show file tree
Hide file tree
Showing 48 changed files with 1,550 additions and 831 deletions.
4 changes: 4 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,14 @@ BITCOIN_CORE_H = \
threadsafety.h \
threadinterrupt.h \
timedata.h \
tokens/groups.h \
tokens/tokendb.h \
tokens/tokengroupconfiguration.h \
tokens/tokengroupdescription.h \
tokens/tokengroupmanager.h \
tokens/tokengroupwallet.h \
torcontrol.h \
transactionrecord.h \
txdb.h \
txmempool.h \
ui_interface.h \
Expand Down Expand Up @@ -418,6 +420,7 @@ libion_wallet_a_SOURCES = \
privatesend/privatesend-util.cpp \
tokens/rpctokenwallet.cpp \
tokens/tokengroupwallet.cpp \
transactionrecord.cpp \
wallet/crypter.cpp \
wallet/db.cpp \
wallet/rpcdump.cpp \
Expand Down Expand Up @@ -610,6 +613,7 @@ libion_common_a_SOURCES = \
script/standard.cpp \
script/tokengroup.cpp \
script/sign.cpp \
tokens/groups.cpp \
tokens/rpctokens.cpp \
tokens/tokendb.cpp \
tokens/tokengroupconfiguration.cpp \
Expand Down
2 changes: 0 additions & 2 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ BITCOIN_QT_H = \
qt/transactiondesc.h \
qt/transactiondescdialog.h \
qt/transactionfilterproxy.h \
qt/transactionrecord.h \
qt/transactiontablemodel.h \
qt/transactionview.h \
qt/utilitydialog.h \
Expand Down Expand Up @@ -288,7 +287,6 @@ BITCOIN_QT_WALLET_CPP = \
qt/transactiondesc.cpp \
qt/transactiondescdialog.cpp \
qt/transactionfilterproxy.cpp \
qt/transactionrecord.cpp \
qt/transactiontablemodel.cpp \
qt/transactionview.cpp \
qt/walletframe.cpp \
Expand Down
13 changes: 10 additions & 3 deletions src/blockencodings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@

CBlockHeaderAndShortTxIDs::CBlockHeaderAndShortTxIDs(const CBlock& block) :
nonce(GetRand(std::numeric_limits<uint64_t>::max())),
shorttxids(block.vtx.size() - 1), prefilledtxn(1), header(block) {
header(block), vchBlockSig(block.vchBlockSig) {
FillShortTxIDSelector();
//TODO: Use our mempool prior to block acceptance to predictively fill more than just the coinbase
prefilledtxn.resize(block.IsProofOfStake() ? 2 : 1);
prefilledtxn[0] = {0, block.vtx[0]};
for (size_t i = 1; i < block.vtx.size(); i++) {
if (block.IsProofOfStake()) {
prefilledtxn[1] = {0, block.vtx[1]};
}
shorttxids.resize(block.vtx.size() - prefilledtxn.size());
for (size_t i = prefilledtxn.size(); i < block.vtx.size(); i++) {
const CTransaction& tx = *block.vtx[i];
shorttxids[i - 1] = GetShortID(tx.GetHash());
shorttxids[i - prefilledtxn.size()] = GetShortID(tx.GetHash());
}
}

Expand Down Expand Up @@ -55,6 +60,7 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c

assert(header.IsNull() && txn_available.empty());
header = cmpctblock.header;
vchBlockSig = cmpctblock.vchBlockSig;
txn_available.resize(cmpctblock.BlockTxCount());

int32_t lastprefilledindex = -1;
Expand Down Expand Up @@ -179,6 +185,7 @@ ReadStatus PartiallyDownloadedBlock::FillBlock(CBlock& block, const std::vector<
assert(!header.IsNull());
uint256 hash = header.GetHash();
block = header;
block.vchBlockSig = vchBlockSig;
block.vtx.resize(txn_available.size());

size_t tx_missing_offset = 0;
Expand Down
3 changes: 3 additions & 0 deletions src/blockencodings.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class CBlockHeaderAndShortTxIDs {

public:
CBlockHeader header;
std::vector<unsigned char> vchBlockSig;

// Dummy for deserialization
CBlockHeaderAndShortTxIDs() {}
Expand All @@ -160,6 +161,7 @@ class CBlockHeaderAndShortTxIDs {
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(header);
READWRITE(nonce);
READWRITE(vchBlockSig);

uint64_t shorttxids_size = (uint64_t)shorttxids.size();
READWRITE(COMPACTSIZE(shorttxids_size));
Expand Down Expand Up @@ -198,6 +200,7 @@ class PartiallyDownloadedBlock {
CTxMemPool* pool;
public:
CBlockHeader header;
std::vector<unsigned char> vchBlockSig;
PartiallyDownloadedBlock(CTxMemPool* poolIn) : pool(poolIn) {}

// extra_txn is a list of extra transactions to look at, in <hash, reference> form
Expand Down
8 changes: 4 additions & 4 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ class CTestNetParams : public CChainParams {
consensus.nMasternodePaymentsIncreasePeriod = 10;
consensus.nInstantSendConfirmationsRequired = 2;
consensus.nInstantSendKeepLock = 6;
consensus.nBudgetPaymentsStartBlock = 80000;
consensus.nBudgetPaymentsStartBlock = 99999999;
consensus.nBudgetPaymentsCycleBlocks = 50;
consensus.nBudgetPaymentsWindowBlocks = 10;
consensus.nSuperblockStartBlock = 4200; // NOTE: Should satisfy nSuperblockStartBlock > nBudgetPeymentsStartBlock
Expand All @@ -489,9 +489,9 @@ class CTestNetParams : public CChainParams {
consensus.BIP65Height = 2431; // 0000039cf01242c7f921dcb4806a5994bc003b48c1973ae0c89b67809c2bb2ab
consensus.BIP66Height = 2075; // 0000002acdd29a14583540cb72e1c5cc83783560e38fa7081495d474fe1671f7
consensus.DIP0001Height = 2;
consensus.DIP0003Height = 99999999;
consensus.DIP0003EnforcementHeight = 99999999;
consensus.DIP0003EnforcementHash = uint256S("00000055ebc0e974ba3a3fb785c5ad4365a39637d4df168169ee80d313612f8f");
consensus.DIP0003Height = 141000;
consensus.DIP0003EnforcementHeight = 141067;
// consensus.DIP0003EnforcementHash = uint256S("059e5ee39302d06e3df836154db9818cffb1fcefd2733179b6aec86fb454b9c3");
consensus.IIP0006Height = 99999999;
consensus.powLimit = uint256S("3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 2
consensus.nPowTargetTimespan = 24 * 60 * 60; // Ion: 1 day
Expand Down
Loading

0 comments on commit ecc43c7

Please sign in to comment.