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