inital commit for notarypay 0BR
This commit is contained in:
11
src/main.cpp
11
src/main.cpp
@@ -3269,7 +3269,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||
auto verifier = libzcash::ProofVerifier::Strict();
|
||||
auto disabledVerifier = libzcash::ProofVerifier::Disabled();
|
||||
int32_t futureblock;
|
||||
CAmount blockReward = 0;
|
||||
CAmount blockReward = 0; uint64_t notarypaycheque = 0;
|
||||
// Check it again to verify JoinSplit proofs, and in case a previous version let a bad block in
|
||||
if (!CheckBlock(&futureblock,pindex->GetHeight(),pindex,block, state, fExpensiveChecks ? verifier : disabledVerifier, fCheckPOW, !fJustCheck) || futureblock != 0 )
|
||||
{
|
||||
@@ -3307,7 +3307,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||
return state.DoS(100, error("ConnectBlock(): Notaries have not been paid!"),
|
||||
REJECT_INVALID, "bad-cb-amount");
|
||||
// calculate the notaries compensation and validate the amounts and pubkeys are correct.
|
||||
uint64_t notarypaycheque = komodo_checknotarypay((CBlock *)&block,(int32_t)pindex->GetHeight());
|
||||
notarypaycheque = komodo_checknotarypay((CBlock *)&block,(int32_t)pindex->GetHeight());
|
||||
//fprintf(stderr, "notarypaycheque.%lu\n", notarypaycheque);
|
||||
if ( notarypaycheque > 0 )
|
||||
blockReward += notarypaycheque;
|
||||
@@ -3714,6 +3714,12 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||
|
||||
//FlushStateToDisk();
|
||||
komodo_connectblock(false,pindex,*(CBlock *)&block); // dPoW state update.
|
||||
if ( ASSETCHAINS_NOTARY_PAY[0] != 0 && pindex->GetHeight() > 10 )
|
||||
{
|
||||
// Update the notary pay with the latest payment.
|
||||
pindex->nNotaryPay = pindex->pprev->nNotaryPay + notarypaycheque;
|
||||
fprintf(stderr, "total notary pay.%li\n", pindex->nNotaryPay);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3923,6 +3929,7 @@ bool static DisconnectTip(CValidationState &state, bool fBare = false) {
|
||||
DisconnectNotarisations(block);
|
||||
}
|
||||
pindexDelete->segid = -2;
|
||||
pindexDelete->nNotaryPay = 0;
|
||||
pindexDelete->newcoins = 0;
|
||||
pindexDelete->zfunds = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user