From 815ef1882ea979d687fe9a16cc9a275d583512ce Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 5 Jul 2019 01:48:59 -1100 Subject: [PATCH] satoshis --- src/komodo_nSPV.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index 4936c777d..6dd7bdf53 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -1193,13 +1193,15 @@ void komodo_nSPVresp(CNode *pfrom,std::vector response) // received a r } } +// nSPV wallet + int32_t NSPV_vinselect(int32_t *aboveip,int64_t *abovep,int32_t *belowip,int64_t *belowp,struct NSPV_utxoresp utxos[],int32_t numunspents,int64_t value) { int32_t i,abovei,belowi; int64_t above,below,gap,atx_value; abovei = belowi = -1; for (above=below=i=0; itxid,up->vout,CScript())); - totalinputs += up->nValue; - remains -= up->nValue; + totalinputs += up->satoshis; + remains -= up->satoshis; utxos[ind] = utxos[--n]; memset(&utxos[n],0,sizeof(utxos[n])); //fprintf(stderr,"totalinputs %.8f vs total %.8f i.%d vs max.%d\n",(double)totalinputs/COIN,(double)total/COIN,i,maxinputs); @@ -1294,14 +1296,14 @@ std::string NSPV_signtx(CMutableTransaction &mtx,uint64_t txfee,CScript opret) CTransaction vintx; std::string hex; uint256 hashBlock; int64_t change,totaloutputs=0,totalinputs=0; int32_t i,utxovout,n; n = mtx.vout.size(); for (i=0; i= totaloutputs+2*txfee ) @@ -1318,7 +1320,7 @@ std::string NSPV_signtx(CMutableTransaction &mtx,uint64_t txfee,CScript opret) if ( GetTransaction(mtx.vin[i].prevout.hash,vintx,hashBlock,false) != 0 ) { utxovout = mtx.vin[i].prevout.n; - if ( SignTx(mtx,i,vintx.vout[utxovout].nValue,vintx.vout[utxovout].scriptPubKey) == 0 ) + if ( SignTx(mtx,i,vintx.vout[utxovout].satoshis,vintx.vout[utxovout].scriptPubKey) == 0 ) fprintf(stderr,"signing error for vini.%d of %llx\n",i,(long long)vinimask); } } @@ -1371,7 +1373,7 @@ UniValue NSPV_send(char *srcaddr,char *destaddr,int64_t satoshis) // what its al memcpy(&data[0],&rmd160[1],20); if ( NSPV_addinputs(mtx,satoshis+txfee,64) > 0 ) { - mtx.vout.push_back(CTxOut(nValue,CScript() << OP_DUP << OP_HASH160 << ParseHex(HexStr(data)) << OP_EQUALVERIFY << OP_CHECKSIG)); + mtx.vout.push_back(CTxOut(satoshis,CScript() << OP_DUP << OP_HASH160 << ParseHex(HexStr(data)) << OP_EQUALVERIFY << OP_CHECKSIG)); hex = NSPV_signt(mtx,txfee,opret); result.push_back(Pair("result","success")); result.push_back(Pair("hex",hex));