Browse Source

Test

pull/4/head
jl777 6 years ago
parent
commit
46d1074a67
  1. 6
      src/cc/CCtx.cpp
  2. 2
      src/cc/eval.cpp
  3. 2
      src/main.cpp
  4. 5
      src/script/interpreter.cpp

6
src/cc/CCtx.cpp

@ -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);
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," signed with privkey\n");
mtx.vin[i].scriptSig = CCSig(cond);

2
src/cc/eval.cpp

@ -35,7 +35,7 @@ bool RunCCEval(const CC *cond, const CTransaction &tx, unsigned int nIn)
EvalRef eval;
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);
if (eval->state.IsValid()) return true;

2
src/main.cpp

@ -1365,7 +1365,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
// do we already have it?
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");
}

5
src/script/interpreter.cpp

@ -1313,6 +1313,10 @@ int TransactionSignatureChecker::CheckCryptoCondition(
} catch (logic_error ex) {
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) {
return ((TransactionSignatureChecker*)checker)->CheckEvalCondition(cond);
@ -1320,6 +1324,7 @@ int TransactionSignatureChecker::CheckCryptoCondition(
int out = cc_verify(cond, (const unsigned char*)&sighash, 32, 0,
condBin.data(), condBin.size(), eval, (void*)this);
fprintf(stderr,"out.%d from cc_verify\n",(int32_t)out);
cc_free(cond);
return out;
}

Loading…
Cancel
Save