Stop miner trying to mine invalid block.
This commit is contained in:
@@ -1811,8 +1811,6 @@ uint64_t komodo_notarypay(CMutableTransaction &txNew, std::vector<int8_t> &Notar
|
|||||||
if ( staked_era == 0 )
|
if ( staked_era == 0 )
|
||||||
return(0);
|
return(0);
|
||||||
numSN = numStakedNotaries(staked_pubkeys,staked_era);
|
numSN = numStakedNotaries(staked_pubkeys,staked_era);
|
||||||
// resize coinbase vouts to number of notary nodes +1 for coinbase itself.
|
|
||||||
txNew.vout.resize(NotarisationNotaries.size()+1);
|
|
||||||
|
|
||||||
// Check the notarisation is valid, and extract notarised height.
|
// Check the notarisation is valid, and extract notarised height.
|
||||||
uint64_t voutmask;
|
uint64_t voutmask;
|
||||||
@@ -1833,6 +1831,9 @@ uint64_t komodo_notarypay(CMutableTransaction &txNew, std::vector<int8_t> &Notar
|
|||||||
}
|
}
|
||||||
} else return(0);
|
} else return(0);
|
||||||
|
|
||||||
|
// resize coinbase vouts to number of notary nodes +1 for coinbase itself.
|
||||||
|
txNew.vout.resize(NotarisationNotaries.size()+1);
|
||||||
|
|
||||||
// Calcualte the amount to pay.
|
// Calcualte the amount to pay.
|
||||||
AmountToPay = komodo_notarypayamount(notarizedheight,NotarisationNotaries.size());
|
AmountToPay = komodo_notarypayamount(notarizedheight,NotarisationNotaries.size());
|
||||||
|
|
||||||
|
|||||||
17
src/main.cpp
17
src/main.cpp
@@ -282,6 +282,9 @@ namespace {
|
|||||||
bool fCurrentlyConnected;
|
bool fCurrentlyConnected;
|
||||||
//! Accumulated misbehaviour score for this peer.
|
//! Accumulated misbehaviour score for this peer.
|
||||||
int nMisbehavior;
|
int nMisbehavior;
|
||||||
|
// count blocks seen.
|
||||||
|
//int8_t nBlocksinARow;
|
||||||
|
//int8_t nBlocksinARow2;
|
||||||
//! Whether this peer should be disconnected and banned (unless whitelisted).
|
//! Whether this peer should be disconnected and banned (unless whitelisted).
|
||||||
bool fShouldBan;
|
bool fShouldBan;
|
||||||
//! String name of this peer (debugging/logging purposes).
|
//! String name of this peer (debugging/logging purposes).
|
||||||
@@ -5469,6 +5472,20 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo
|
|||||||
bool checked; uint256 hash; int32_t futureblock=0;
|
bool checked; uint256 hash; int32_t futureblock=0;
|
||||||
auto verifier = libzcash::ProofVerifier::Disabled();
|
auto verifier = libzcash::ProofVerifier::Disabled();
|
||||||
hash = pblock->GetHash();
|
hash = pblock->GetHash();
|
||||||
|
/*pfrom->nBlocksinARow += 1;
|
||||||
|
if ( pfrom->nBlocksinARow >= 6 )
|
||||||
|
{
|
||||||
|
pfrom->nBlocksinARow2 += 1;
|
||||||
|
if ( pfrom->nBlocksinARow2 > 3 )
|
||||||
|
{
|
||||||
|
pfrom->nBlocksinARow = 0;
|
||||||
|
pfrom->nBlocksinARow2 = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
//fprintf(stderr,"ProcessBlock %d\n",(int32_t)chainActive.LastTip()->GetHeight());
|
//fprintf(stderr,"ProcessBlock %d\n",(int32_t)chainActive.LastTip()->GetHeight());
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|||||||
@@ -680,6 +680,11 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
if ( script[0] == OP_RETURN )
|
if ( script[0] == OP_RETURN )
|
||||||
{
|
{
|
||||||
uint64_t totalsats = komodo_notarypay(txNew, NotarisationNotaries, pblock->nTime, nHeight, script, scriptlen);
|
uint64_t totalsats = komodo_notarypay(txNew, NotarisationNotaries, pblock->nTime, nHeight, script, scriptlen);
|
||||||
|
if ( totalsats == 0 )
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Could not create notary payment, trying again.\n");
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
fprintf(stderr, "Created notary payment coinbase totalsat.%lu\n",totalsats);
|
fprintf(stderr, "Created notary payment coinbase totalsat.%lu\n",totalsats);
|
||||||
} else fprintf(stderr, "vout 2 of notarisation is not OP_RETURN scriptlen.%i\n", scriptlen);
|
} else fprintf(stderr, "vout 2 of notarisation is not OP_RETURN scriptlen.%i\n", scriptlen);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user