Browse Source

Txheight

warmup
jl777 5 years ago
parent
commit
aa95a58f26
  1. 8
      src/cc/CCtx.cpp
  2. 1
      src/komodo_nSPV_wallet.h
  3. 26
      src/main.cpp

8
src/cc/CCtx.cpp

@ -280,10 +280,10 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
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++)
fprintf(stderr,"%02x",((uint8_t *)sighash.begin())[z]);
fprintf(stderr," sighash [%d] %.8f %x\n",i,(double)utxovalues[i]/COIN,consensusBranchId);
//int32_t z;
//for (z=0; z<32; z++)
// fprintf(stderr,"%02x",((uint8_t *)sighash.begin())[z]);
//fprintf(stderr," sighash [%d] %.8f %x\n",i,(double)utxovalues[i]/COIN,consensusBranchId);
//for (z=0; z<32; z++)
// fprintf(stderr,"%02x",privkey[z]);
//fprintf(stderr," signed with privkey\n");

1
src/komodo_nSPV_wallet.h

@ -446,7 +446,6 @@ int64_t NSPV_AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total
void NSPV_utxos2CCunspents(struct NSPV_utxosresp *ptr,std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &outputs)
{
CAddressUnspentKey key; CAddressUnspentValue value; int32_t i,type; uint160 hashBytes; std::string addrstr(ptr->coinaddr);
fprintf(stderr,"in converter\n");
if ( ptr->utxos != NULL && ptr->numutxos > 0 )
{
CBitcoinAddress address(addrstr);

26
src/main.cpp

@ -1780,7 +1780,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
//fprintf(stderr,"already in mempool\n");
return state.Invalid(false, REJECT_DUPLICATE, "already in mempool");
}
fprintf(stderr,"addmempool 0\n");
//fprintf(stderr,"addmempool 0\n");
// Node operator can choose to reject tx by number of transparent inputs
static_assert(std::numeric_limits<size_t>::max() >= std::numeric_limits<int64_t>::max(), "size_t too small");
size_t limit = (size_t) GetArg("-mempooltxinputlimit", 0);
@ -1794,7 +1794,7 @@ fprintf(stderr,"addmempool 0\n");
return false;
}
}
fprintf(stderr,"addmempool 1\n");
//fprintf(stderr,"addmempool 1\n");
auto verifier = libzcash::ProofVerifier::Strict();
if ( ASSETCHAINS_SYMBOL[0] == 0 && komodo_validate_interest(tx,chainActive.LastTip()->GetHeight()+1,chainActive.LastTip()->GetMedianTimePast() + 777,0) < 0 )
@ -1812,7 +1812,7 @@ fprintf(stderr,"addmempool 1\n");
{
return error("AcceptToMemoryPool: ContextualCheckTransaction failed");
}
fprintf(stderr,"addmempool 2\n");
//fprintf(stderr,"addmempool 2\n");
// Coinbase is only valid in a block, not as a loose transaction
if (tx.IsCoinBase())
{
@ -1835,7 +1835,7 @@ fprintf(stderr,"addmempool 2\n");
//fprintf(stderr,"AcceptToMemoryPool reject non-final\n");
return state.DoS(0, false, REJECT_NONSTANDARD, "non-final");
}
fprintf(stderr,"addmempool 3\n");
//fprintf(stderr,"addmempool 3\n");
// Check for conflicts with in-memory transactions
if (!fSkipExpiry)
@ -1864,7 +1864,7 @@ fprintf(stderr,"addmempool 3\n");
}
}
}
fprintf(stderr,"addmempool 4\n");
//fprintf(stderr,"addmempool 4\n");
{
CCoinsView dummy;
@ -1964,7 +1964,7 @@ fprintf(stderr,"addmempool 4\n");
}
}
}
fprintf(stderr,"addmempool 5\n");
//fprintf(stderr,"addmempool 5\n");
// Grab the branch ID we expect this transaction to commit to. We don't
// yet know if it does, but if the entry gets added to the mempool, then
@ -2027,7 +2027,7 @@ fprintf(stderr,"addmempool 5\n");
LogPrint("mempool", errmsg.c_str());
return state.Error("AcceptToMemoryPool: " + errmsg);
}
fprintf(stderr,"addmempool 6\n");
//fprintf(stderr,"addmempool 6\n");
// Check against previous transactions
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
@ -2053,7 +2053,7 @@ fprintf(stderr,"addmempool 6\n");
flag = 1;
KOMODO_CONNECTING = (1<<30) + (int32_t)chainActive.LastTip()->GetHeight() + 1;
}
fprintf(stderr,"addmempool 7\n");
//fprintf(stderr,"addmempool 7\n");
if (!fSkipExpiry && !ContextualCheckInputs(tx, state, view, true, MANDATORY_SCRIPT_VERIFY_FLAGS, true, txdata, Params().GetConsensus(), consensusBranchId))
{
if ( flag != 0 )
@ -2229,8 +2229,14 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo
memset(&hashBlock,0,sizeof(hashBlock));
if ( KOMODO_NSPV != 0 )
{
int64_t rewardsum = 0; int32_t retval,vout = 0;
retval = NSPV_gettransaction(1,vout,hash,0,txOut,0,0,rewardsum);
int64_t rewardsum = 0; int32_t i,retval,txheight = 0,vout = 0;
for (i=0; i<NSPV_U.numutxos; i++)
if ( NSPV_U.utxos[i].txid == txid )
{
txheight = NSPV_U.utxos[i].height;
break;
}
retval = NSPV_gettransaction(1,vout,hash,txheight,txOut,0,0,rewardsum);
return(retval == 0);
}
// need a GetTransaction without lock so the validation code for assets can run without deadlock

Loading…
Cancel
Save