Browse Source

Egret

warmup
jl777 5 years ago
parent
commit
8bc632b4e5
  1. 10
      src/cc/CCtx.cpp
  2. 6
      src/cc/CCutils.cpp
  3. 2
      src/komodo_nSPV.h
  4. 1
      src/komodo_nSPV_wallet.h
  5. 2
      src/main.cpp

10
src/cc/CCtx.cpp

@ -46,7 +46,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus());
CTransaction vintx; std::string hex; CPubKey globalpk; uint256 hashBlock; uint64_t mask=0,nmask=0,vinimask=0;
int64_t utxovalues[CC_MAXVINS],change,normalinputs=0,totaloutputs=0,normaloutputs=0,totalinputs=0,normalvins=0,ccvins=0;
int32_t i,flag,utxovout,n,err = 0;
int32_t i,flag,mgret,utxovout,n,err = 0;
char myaddr[64], destaddr[64], unspendable[64], mytokensaddr[64], mysingletokensaddr[64], unspendabletokensaddr[64],CC1of2CCaddr[64];
uint8_t *privkey, myprivkey[32], unspendablepriv[32], /*tokensunspendablepriv[32],*/ *msg32 = 0;
CC *mycond=0, *othercond=0, *othercond2=0,*othercond4=0, *othercond3=0, *othercond1of2=NULL, *othercond1of2tokens = NULL, *cond=0, *condCC2=0,*mytokenscond = NULL, *mysingletokenscond = NULL, *othertokenscond = NULL;
@ -118,7 +118,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
for (i=0; i<n; i++)
{
if (i==0 && mtx.vin[i].prevout.n==10e8) continue;
if ( myGetTransaction(mtx.vin[i].prevout.hash,vintx,hashBlock) != 0 )
if ( (mgret= myGetTransaction(mtx.vin[i].prevout.hash,vintx,hashBlock)) != 0 )
{
utxovout = mtx.vin[i].prevout.n;
utxovalues[i] = vintx.vout[utxovout].nValue;
@ -133,7 +133,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
{
mask |= (1LL << i);
}
} else fprintf(stderr,"FinalizeCCTx couldnt find %s\n",mtx.vin[i].prevout.hash.ToString().c_str());
} else fprintf(stderr,"FinalizeCCTx couldnt find %s mgret.%d\n",mtx.vin[i].prevout.hash.ToString().c_str(),mgret);
}
nmask = (1LL << n) - 1;
if ( 0 && (mask & nmask) != (CCmask & nmask) )
@ -151,7 +151,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
{
if (i==0 && mtx.vin[i].prevout.n==10e8)
continue;
if ( myGetTransaction(mtx.vin[i].prevout.hash,vintx,hashBlock) != 0 )
if ( (mgret= myGetTransaction(mtx.vin[i].prevout.hash,vintx,hashBlock)) != 0 )
{
utxovout = mtx.vin[i].prevout.n;
if ( vintx.vout[utxovout].scriptPubKey.IsPayToCryptoCondition() == 0 )
@ -297,7 +297,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
return("");
}
}
} else fprintf(stderr,"FinalizeCCTx couldnt find %s\n",mtx.vin[i].prevout.hash.ToString().c_str());
} else fprintf(stderr,"FinalizeCCTx2 couldnt find %s mgret.%d\n",mtx.vin[i].prevout.hash.ToString().c_str(),mgret);
}
if ( mycond != 0 )
cc_free(mycond);

6
src/cc/CCutils.cpp

@ -452,9 +452,9 @@ bool Myprivkey(uint8_t myprivkey[])
{
vchSecret = DecodeSecret(NSPV_wifstr);
memcpy(myprivkey,vchSecret.begin(),32);
for (i=0; i<32; i++)
fprintf(stderr,"%02x",myprivkey[i]);
fprintf(stderr," myprivkey %s\n",NSPV_wifstr);
//for (i=0; i<32; i++)
// fprintf(stderr,"%02x",myprivkey[i]);
//fprintf(stderr," myprivkey %s\n",NSPV_wifstr);
memset((uint8_t *)vchSecret.begin(),0,32);
return true;
}

2
src/komodo_nSPV.h

@ -16,7 +16,7 @@
// todo:
// CC signing
// myprivkey, scrub all destination buffers
// headers "sync" make sure it connects to prior blocks to notarization. use getinfo hdrht to get missing hdrs

1
src/komodo_nSPV_wallet.h

@ -61,6 +61,7 @@ int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int32_t height,CTransaction &tx,int64_t extradata,uint32_t tiptime,int64_t &rewardsum)
{
struct NSPV_txproof *ptr; int32_t i,offset,retval = 0; int64_t rewards = 0; uint32_t nLockTime; std::vector<uint8_t> proof;
fprintf(stderr,"NSPV_gettx %s/v%d ht.%d\n",txid.GetHex().c_str(),vout,height);
if ( (ptr= NSPV_txproof_find(txid)) == 0 )
{
NSPV_txproof(vout,txid,height);

2
src/main.cpp

@ -2236,7 +2236,7 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo
txheight = NSPV_U.U.utxos[i].height;
break;
}
retval = NSPV_gettransaction(1,vout,hash,txheight,txOut,0,0,rewardsum);
retval = NSPV_gettransaction(txheight == 0,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