Test
This commit is contained in:
@@ -121,7 +121,11 @@ std::string FinalizeCCTx(uint8_t evalcode,CMutableTransaction &mtx,CPubKey mypk,
|
|||||||
uint256 sighash = SignatureHash(CCPubKey(cond), mtx, i, SIGHASH_ALL, utxovalues[i],consensusBranchId, &txdata);
|
uint256 sighash = SignatureHash(CCPubKey(cond), mtx, i, SIGHASH_ALL, utxovalues[i],consensusBranchId, &txdata);
|
||||||
if ( cc_signTreeSecp256k1Msg32(cond,privkey,sighash.begin()) != 0 )
|
if ( cc_signTreeSecp256k1Msg32(cond,privkey,sighash.begin()) != 0 )
|
||||||
{
|
{
|
||||||
int32_t z; for (z=0; z<32; z++)
|
int32_t z;
|
||||||
|
for (z=0; z<32; z++)
|
||||||
|
fprintf(stderr,"%02x",((uint8_t *)sighash.begin())[z]);
|
||||||
|
fprintf(stderr," sighash, ");
|
||||||
|
for (z=0; z<32; z++)
|
||||||
fprintf(stderr,"%02x",privkey[z]);
|
fprintf(stderr,"%02x",privkey[z]);
|
||||||
fprintf(stderr," signed with privkey\n");
|
fprintf(stderr," signed with privkey\n");
|
||||||
mtx.vin[i].scriptSig = CCSig(cond);
|
mtx.vin[i].scriptSig = CCSig(cond);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ bool RunCCEval(const CC *cond, const CTransaction &tx, unsigned int nIn)
|
|||||||
EvalRef eval;
|
EvalRef eval;
|
||||||
|
|
||||||
bool out = eval->Dispatch(cond, tx, nIn);
|
bool out = eval->Dispatch(cond, tx, nIn);
|
||||||
//fprintf(stderr,"out %d vs %d isValid\n",(int32_t)out,(int32_t)eval->state.IsValid());
|
fprintf(stderr,"out %d vs %d isValid\n",(int32_t)out,(int32_t)eval->state.IsValid());
|
||||||
assert(eval->state.IsValid() == out);
|
assert(eval->state.IsValid() == out);
|
||||||
|
|
||||||
if (eval->state.IsValid()) return true;
|
if (eval->state.IsValid()) return true;
|
||||||
|
|||||||
@@ -1365,7 +1365,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
// do we already have it?
|
// do we already have it?
|
||||||
if (view.HaveCoins(hash))
|
if (view.HaveCoins(hash))
|
||||||
{
|
{
|
||||||
fprintf(stderr,"view.HaveCoins(hash) error\n");
|
//fprintf(stderr,"view.HaveCoins(hash) error\n");
|
||||||
return state.Invalid(false, REJECT_DUPLICATE, "already have coins");
|
return state.Invalid(false, REJECT_DUPLICATE, "already have coins");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1313,6 +1313,10 @@ int TransactionSignatureChecker::CheckCryptoCondition(
|
|||||||
} catch (logic_error ex) {
|
} catch (logic_error ex) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int32_t z;
|
||||||
|
for (z=0; z<32; z++)
|
||||||
|
fprintf(stderr,"%02x",((uint8_t *)&sighash)[z]);
|
||||||
|
fprintf(stderr," sighash\n");
|
||||||
|
|
||||||
VerifyEval eval = [] (CC *cond, void *checker) {
|
VerifyEval eval = [] (CC *cond, void *checker) {
|
||||||
return ((TransactionSignatureChecker*)checker)->CheckEvalCondition(cond);
|
return ((TransactionSignatureChecker*)checker)->CheckEvalCondition(cond);
|
||||||
@@ -1320,6 +1324,7 @@ int TransactionSignatureChecker::CheckCryptoCondition(
|
|||||||
|
|
||||||
int out = cc_verify(cond, (const unsigned char*)&sighash, 32, 0,
|
int out = cc_verify(cond, (const unsigned char*)&sighash, 32, 0,
|
||||||
condBin.data(), condBin.size(), eval, (void*)this);
|
condBin.data(), condBin.size(), eval, (void*)this);
|
||||||
|
fprintf(stderr,"out.%d from cc_verify\n",(int32_t)out);
|
||||||
cc_free(cond);
|
cc_free(cond);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user