test
This commit is contained in:
@@ -462,6 +462,7 @@ bool CCoinsViewCache::HaveInputs(const CTransaction& tx) const
|
||||
const COutPoint &prevout = tx.vin[i].prevout;
|
||||
const CCoins* coins = AccessCoins(prevout.hash);
|
||||
if (!coins || !coins->IsAvailable(prevout.n)) {
|
||||
fprintf(stderr,"HaveInputs missing input %s/v%d\n",prevout.hash.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -683,18 +683,21 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
|
||||
}
|
||||
}
|
||||
n = block.vtx[0].vout.size();
|
||||
script = (uint8_t *)block.vtx[0].vout[n-1].scriptPubKey.data();
|
||||
//script = (uint8_t *)block.vtx[0].vout[n-1].scriptPubKey.data();
|
||||
//if ( n <= 2 || script[0] != 0x6a )
|
||||
{
|
||||
int64_t val,prevtotal = 0; int32_t overflow = 0;
|
||||
int64_t val,strangeout=0,prevtotal = 0; int32_t overflow = 0;
|
||||
total = 0;
|
||||
for (i=1; i<n; i++)
|
||||
{
|
||||
script = (uint8_t *)block.vtx[0].vout[i].scriptPubKey.data();
|
||||
if ( (val= block.vtx[0].vout[i].nValue) < 0 || val >= MAX_MONEY )
|
||||
{
|
||||
overflow = 1;
|
||||
break;
|
||||
}
|
||||
if ( script[0] != 0x6a && val == 0 )
|
||||
strangeout++;
|
||||
total += val;
|
||||
if ( total < prevtotal || (val != 0 && total == prevtotal) )
|
||||
{
|
||||
@@ -719,10 +722,14 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
|
||||
if ( height > KOMODO_NOTARIES_HEIGHT1 )
|
||||
return(-1);
|
||||
}
|
||||
if ( height > 800000 && strangeout != 0 )
|
||||
{
|
||||
fprintf(stderr,"ht.%d strangout.%d\n",height,strangeout);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( overflow != 0 || total > 0 )
|
||||
if ( overflow != 0 || total > 0 || strangeout != 0 )
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
|
||||
@@ -2684,9 +2684,10 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||
if (!tx.IsCoinBase())
|
||||
{
|
||||
if (!view.HaveInputs(tx))
|
||||
{
|
||||
return state.DoS(100, error("ConnectBlock(): inputs missing/spent"),
|
||||
REJECT_INVALID, "bad-txns-inputs-missingorspent");
|
||||
|
||||
}
|
||||
// are the JoinSplit's requirements met?
|
||||
if (!view.HaveJoinSplitRequirements(tx))
|
||||
return state.DoS(100, error("ConnectBlock(): JoinSplit requirements not met"),
|
||||
|
||||
@@ -491,7 +491,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||
pblocktemplate->vTxFees.push_back(txfees);
|
||||
pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txNotary));
|
||||
nFees += txfees;
|
||||
fprintf(stderr,"add notaryvin\n");
|
||||
//fprintf(stderr,"add notaryvin\n");
|
||||
} else fprintf(stderr,"error adding notaryvin\n");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -4505,10 +4505,11 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33)
|
||||
continue;
|
||||
}
|
||||
utxovalue = (uint64_t)nValue;
|
||||
decode_hex((uint8_t *)&utxotxid,32,(char *)out.tx->GetHash().GetHex().c_str());
|
||||
//decode_hex((uint8_t *)&utxotxid,32,(char *)out.tx->GetHash().GetHex().c_str());
|
||||
utxotxid = out.tx->GetHash();
|
||||
utxovout = out.i;
|
||||
best_scriptPubKey = out.tx->vout[out.i].scriptPubKey;
|
||||
fprintf(stderr,"check %s/v%d %llu\n",(char *)out.tx->GetHash().GetHex().c_str(),utxovout,(long long)utxovalue);
|
||||
//fprintf(stderr,"check %s/v%d %llu\n",(char *)out.tx->GetHash().GetHex().c_str(),utxovout,(long long)utxovalue);
|
||||
|
||||
bool signSuccess; SignatureData sigdata; uint64_t txfee; uint8_t *ptr; uint256 revtxid,utxotxid;
|
||||
auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus());
|
||||
@@ -4516,9 +4517,9 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33)
|
||||
txNew.vin.resize(1);
|
||||
txNew.vout.resize(1);
|
||||
txfee = utxovalue / 2;;
|
||||
for (i=0; i<32; i++)
|
||||
((uint8_t *)&revtxid)[i] = ((uint8_t *)&utxotxid)[31 - i];
|
||||
txNew.vin[0].prevout.hash = revtxid;
|
||||
//for (i=0; i<32; i++)
|
||||
// ((uint8_t *)&revtxid)[i] = ((uint8_t *)&utxotxid)[31 - i];
|
||||
txNew.vin[0].prevout.hash = utxotxid; //revtxid;
|
||||
txNew.vin[0].prevout.n = utxovout;
|
||||
txNew.vout[0].scriptPubKey = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;
|
||||
txNew.vout[0].nValue = utxovalue - txfee;
|
||||
@@ -4532,8 +4533,8 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33)
|
||||
ptr = (uint8_t *)sigdata.scriptSig.data();
|
||||
siglen = sigdata.scriptSig.size();
|
||||
for (i=0; i<siglen; i++)
|
||||
utxosig[i] = ptr[i], fprintf(stderr,"%02x",ptr[i]);
|
||||
fprintf(stderr," siglen.%d notaryvin\n",siglen);
|
||||
utxosig[i] = ptr[i];//, fprintf(stderr,"%02x",ptr[i]);
|
||||
//fprintf(stderr," siglen.%d notaryvin\n",siglen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user