mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-13 16:48:08 +00:00
Fixed functional test cases.
This commit is contained in:
parent
33ed36e5bf
commit
06770c9b2c
@ -213,6 +213,9 @@ public:
|
|||||||
uint32_t nBits;
|
uint32_t nBits;
|
||||||
uint32_t nNonce;
|
uint32_t nNonce;
|
||||||
|
|
||||||
|
//! Cryptonote header
|
||||||
|
CryptoNoteHeader cnHeader;
|
||||||
|
|
||||||
//! (memory only) Sequential id assigned to distinguish order in which blocks are received.
|
//! (memory only) Sequential id assigned to distinguish order in which blocks are received.
|
||||||
int32_t nSequenceId;
|
int32_t nSequenceId;
|
||||||
|
|
||||||
@ -240,6 +243,7 @@ public:
|
|||||||
nTime = 0;
|
nTime = 0;
|
||||||
nBits = 0;
|
nBits = 0;
|
||||||
nNonce = 0;
|
nNonce = 0;
|
||||||
|
cnHeader.SetNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
CBlockIndex()
|
CBlockIndex()
|
||||||
@ -256,6 +260,7 @@ public:
|
|||||||
nTime = block.nTime;
|
nTime = block.nTime;
|
||||||
nBits = block.nBits;
|
nBits = block.nBits;
|
||||||
nNonce = block.nNonce;
|
nNonce = block.nNonce;
|
||||||
|
cnHeader = block.cnHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDiskBlockPos GetBlockPos() const {
|
CDiskBlockPos GetBlockPos() const {
|
||||||
@ -286,6 +291,7 @@ public:
|
|||||||
block.nTime = nTime;
|
block.nTime = nTime;
|
||||||
block.nBits = nBits;
|
block.nBits = nBits;
|
||||||
block.nNonce = nNonce;
|
block.nNonce = nNonce;
|
||||||
|
block.cnHeader = cnHeader;
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,6 +416,7 @@ public:
|
|||||||
READWRITE(nTime);
|
READWRITE(nTime);
|
||||||
READWRITE(nBits);
|
READWRITE(nBits);
|
||||||
READWRITE(nNonce);
|
READWRITE(nNonce);
|
||||||
|
READWRITE(cnHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 GetBlockHash() const
|
uint256 GetBlockHash() const
|
||||||
@ -421,6 +428,7 @@ public:
|
|||||||
block.nTime = nTime;
|
block.nTime = nTime;
|
||||||
block.nBits = nBits;
|
block.nBits = nBits;
|
||||||
block.nNonce = nNonce;
|
block.nNonce = nNonce;
|
||||||
|
block.cnHeader = cnHeader;
|
||||||
return block.GetHash();
|
return block.GetHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,9 +313,9 @@ public:
|
|||||||
nDefaultPort = 19444;
|
nDefaultPort = 19444;
|
||||||
nPruneAfterHeight = 1000;
|
nPruneAfterHeight = 1000;
|
||||||
|
|
||||||
genesis = CreateGenesisBlock(1553147907, 6, 0x207fffff, 1, 50 * COIN);
|
genesis = CreateGenesisBlock(1296688602, 0, 0x207fffff, 1, 50 * COIN);
|
||||||
consensus.hashGenesisBlock = genesis.GetHash();
|
consensus.hashGenesisBlock = genesis.GetHash();
|
||||||
assert(consensus.hashGenesisBlock == uint256S("0x16c9c15caf4524e61004fcd4feb2217818b8884d4ad9b8769f5ea6c62c69097e"));
|
assert(consensus.hashGenesisBlock == uint256S("0x5b2e996d458adbf5c81b381f90ca167732bc9f4e9c1c4ec8485fa74efe793ed8"));
|
||||||
assert(genesis.hashMerkleRoot == uint256S("0x13ec98c3307b8e6b67b91c605c7347916a99f9dfde7b5d88365aaef322192314"));
|
assert(genesis.hashMerkleRoot == uint256S("0x13ec98c3307b8e6b67b91c605c7347916a99f9dfde7b5d88365aaef322192314"));
|
||||||
|
|
||||||
vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
|
vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
|
||||||
@ -327,7 +327,7 @@ public:
|
|||||||
|
|
||||||
checkpointData = {
|
checkpointData = {
|
||||||
{
|
{
|
||||||
{0, uint256S("530827f38f93b43ed12af0b3ad25a288dc02ed74d6d7857862df51fc56c416f9")},
|
{0, uint256S("5b2e996d458adbf5c81b381f90ca167732bc9f4e9c1c4ec8485fa74efe793ed8")},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGen
|
|||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
IncrementExtraNonce(pblock, chainActive.Tip(), nExtraNonce);
|
IncrementExtraNonce(pblock, chainActive.Tip(), nExtraNonce);
|
||||||
}
|
}
|
||||||
pblock->cnHeader.prev_id = pblock->GetHash();
|
pblock->cnHeader.prev_id = pblock->GetOriginalBlockHash();
|
||||||
while (nMaxTries > 0 && pblock->nNonce < nInnerLoopCount && !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, Params().GetConsensus())) {
|
while (nMaxTries > 0 && pblock->nNonce < nInnerLoopCount && !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, Params().GetConsensus())) {
|
||||||
++pblock->cnHeader.nonce;
|
++pblock->cnHeader.nonce;
|
||||||
--nMaxTries;
|
--nMaxTries;
|
||||||
|
@ -2040,6 +2040,7 @@ CAmount CWallet::GetBalance() const
|
|||||||
CAmount nTotal = 0;
|
CAmount nTotal = 0;
|
||||||
{
|
{
|
||||||
LOCK2(cs_main, cs_wallet);
|
LOCK2(cs_main, cs_wallet);
|
||||||
|
|
||||||
for (const auto& entry : mapWallet)
|
for (const auto& entry : mapWallet)
|
||||||
{
|
{
|
||||||
const CWalletTx* pcoin = &entry.second;
|
const CWalletTx* pcoin = &entry.second;
|
||||||
@ -3170,7 +3171,8 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey, CCon
|
|||||||
auto rejectReason = state.GetRejectReason();
|
auto rejectReason = state.GetRejectReason();
|
||||||
LogPrintf("CommitTransaction(): Transaction cannot be broadcast immediately, %s\n", rejectReason);
|
LogPrintf("CommitTransaction(): Transaction cannot be broadcast immediately, %s\n", rejectReason);
|
||||||
// TODO: if we expect the failure to be long term or permanent, instead delete wtx from the wallet and return failure.
|
// TODO: if we expect the failure to be long term or permanent, instead delete wtx from the wallet and return failure.
|
||||||
if (rejectReason == "too-long-mempool-chain") {
|
bool isRegTest = Params().NetworkIDString() == CBaseChainParams::REGTEST;
|
||||||
|
if (!isRegTest && rejectReason == "too-long-mempool-chain") {
|
||||||
LogPrintf("Abandon the too-long-mempool-chain Tx: %s \n", wtx.GetHash().ToString().c_str());
|
LogPrintf("Abandon the too-long-mempool-chain Tx: %s \n", wtx.GetHash().ToString().c_str());
|
||||||
AbandonTransaction(wtx.GetHash());
|
AbandonTransaction(wtx.GetHash());
|
||||||
return false;
|
return false;
|
||||||
@ -4271,6 +4273,7 @@ int CMerkleTx::GetBlocksToMaturity() const
|
|||||||
{
|
{
|
||||||
if (!IsCoinBase())
|
if (!IsCoinBase())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return std::max(0, (COINBASE_MATURITY+1) - GetDepthInMainChain());
|
return std::max(0, (COINBASE_MATURITY+1) - GetDepthInMainChain());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user