Connect addressutxos to addnormalinputs
This commit is contained in:
@@ -525,7 +525,11 @@ int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int3
|
||||
{
|
||||
int32_t abovei,belowi,ind,vout,i,n = 0; int64_t sum,threshold,above,below; int64_t remains,nValue,totalinputs = 0; uint256 txid,hashBlock; std::vector<COutput> vecOutputs; CTransaction tx; struct CC_utxo *utxos,*up;
|
||||
if ( KOMODO_NSPV != 0 )
|
||||
return(NSPV_AddNormalinputs(mtx,mypk,total,maxinputs,ptr));
|
||||
{
|
||||
if ( ptr != 0 )
|
||||
return(NSPV_AddNormalinputs(mtx,mypk,total,maxinputs,ptr));
|
||||
else return(0);
|
||||
}
|
||||
#ifdef ENABLE_WALLET
|
||||
assert(pwalletMain != NULL);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
|
||||
@@ -128,6 +128,16 @@ void NSPV_utxosresp_purge(struct NSPV_utxosresp *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
void NSPV_utxosresp_copy(struct NSPV_utxosresp *dest,struct NSPV_utxosresp *ptr)
|
||||
{
|
||||
*dest = *ptr;
|
||||
if ( ptr->utxos != 0 )
|
||||
{
|
||||
dest->utxos = (struct NSPV_utxoresp *)malloc(ptr->numutxos * sizeof(*ptr->utxos));
|
||||
memcpy(dest->utxos,ptr->utxos,ptr->numutxos * sizeof(*ptr->utxos));
|
||||
}
|
||||
}
|
||||
|
||||
int32_t NSPV_rwntz(int32_t rwflag,uint8_t *serialized,struct NSPV_ntz *ptr)
|
||||
{
|
||||
int32_t len = 0;
|
||||
|
||||
@@ -408,8 +408,16 @@ UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its a
|
||||
|
||||
int64_t NSPV_AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs,struct NSPV_CCmtxinfo *ptr)
|
||||
{
|
||||
char coinaddr[64]; int32_t CCflag = 0;
|
||||
if ( ptr != 0 )
|
||||
{
|
||||
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG);
|
||||
if ( strcmp(ptr->U.coinaddr,coinaddr) != 0 )
|
||||
{
|
||||
NSPV_addressutxos(coinaddr,CCflag);
|
||||
NSPV_utxosresp_purge(&ptr->U);
|
||||
NSPV_utxosresp_copy(&ptr->U,&NSPV_utxosresult);
|
||||
}
|
||||
memset(ptr->used,0,sizeof(ptr->used));
|
||||
return(NSPV_addinputs(ptr->used,mtx,total,maxinputs,ptr->U.utxos,ptr->U.numutxos));
|
||||
} else return(0);
|
||||
|
||||
Reference in New Issue
Block a user