Update superblock valid checking to allow block creation by p2pool (#1190)
* Update superblock valid checking to allow block creation by p2pool * Comment correction for superblock payment not found. * Comment correction
This commit is contained in:
parent
6a3550b94f
commit
3914f4a1c4
@ -670,8 +670,7 @@ bool CSuperblock::IsValid(const CTransaction& txNew, int nBlockHeight, CAmount b
|
||||
nOutputs, nPayments, GetGovernanceObject()->GetDataAsHex());
|
||||
|
||||
// We require an exact match (including order) between the expected
|
||||
// superblock payments and the payments actually in the block, after
|
||||
// skipping any initial miner payments.
|
||||
// superblock payments and the payments actually in the block.
|
||||
|
||||
if(nMinerPayments < 0) {
|
||||
// This means the block cannot have all the superblock payments
|
||||
@ -696,6 +695,7 @@ bool CSuperblock::IsValid(const CTransaction& txNew, int nBlockHeight, CAmount b
|
||||
return false;
|
||||
}
|
||||
|
||||
int nVoutIndex = 0;
|
||||
for(int i = 0; i < nPayments; i++) {
|
||||
CGovernancePayment payment;
|
||||
if(!GetPayment(i, payment)) {
|
||||
@ -704,18 +704,26 @@ bool CSuperblock::IsValid(const CTransaction& txNew, int nBlockHeight, CAmount b
|
||||
continue;
|
||||
}
|
||||
|
||||
int nVoutIndex = nMinerPayments + i;
|
||||
bool fPaymentMatch = false;
|
||||
|
||||
bool fPaymentMatch = ((payment.script == txNew.vout[nVoutIndex].scriptPubKey) &&
|
||||
(payment.nAmount == txNew.vout[nVoutIndex].nValue));
|
||||
for (int j = nVoutIndex; j < nOutputs; j++) {
|
||||
// Find superblock payment
|
||||
fPaymentMatch = ((payment.script == txNew.vout[j].scriptPubKey) &&
|
||||
(payment.nAmount == txNew.vout[j].nValue));
|
||||
|
||||
if (fPaymentMatch) {
|
||||
nVoutIndex = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!fPaymentMatch) {
|
||||
// MISMATCHED SUPERBLOCK OUTPUT!
|
||||
// Superblock payment not found!
|
||||
|
||||
CTxDestination address1;
|
||||
ExtractDestination(payment.script, address1);
|
||||
CBitcoinAddress address2(address1);
|
||||
LogPrintf("CSuperblock::IsValid -- ERROR: Block invalid: output n %d payment %d to %s\n", nVoutIndex, payment.nAmount, address2.ToString());
|
||||
LogPrintf("CSuperblock::IsValid -- ERROR: Block invalid: %d payment %d to %s not found\n", i, payment.nAmount, address2.ToString());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user