diff --git a/src/cc/CCPayments.h b/src/cc/CCPayments.h index 247a0f2ec..56d36f74e 100644 --- a/src/cc/CCPayments.h +++ b/src/cc/CCPayments.h @@ -29,6 +29,6 @@ UniValue PaymentsFund(struct CCcontract_info *cp,char *jsonstr); UniValue PaymentsTxidopret(struct CCcontract_info *cp,char *jsonstr); UniValue PaymentsCreate(struct CCcontract_info *cp,char *jsonstr); UniValue PaymentsInfo(struct CCcontract_info *cp,char *jsonstr); -UniValue PaymentsList(struct CCcontract_info *cp,char *jsonstr); +UniValue PaymentsList(struct CCcontract_info *cp); #endif diff --git a/src/cc/payments.cpp b/src/cc/payments.cpp index d1e11dae5..8148be180 100644 --- a/src/cc/payments.cpp +++ b/src/cc/payments.cpp @@ -152,8 +152,23 @@ bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & { // one of two addresses // change must go to 1of2 txidaddr + // change is/must be in vout[0] // only 'F' or 1of2 txidaddr can be spent // all vouts must match exactly + BOOST_FOREACH(const CTxIn& vin, tx) + { + uint256 blockhash; CTransaction txin; + if ( myGetTransaction(vin.prevout.hash,txin,blockhash) ) + { + fprintf(stderr, "vin txid.%s\n", txin.GetHex().c_str()); + } + } + + BOOST_FOREACH(const CTxOut& vout, tx) + { + fprintf(stderr, "vout txid.%s\n", vout.hash.GetHex().c_str()); + } + return(true); } // end of consensus code @@ -377,6 +392,10 @@ UniValue PaymentsRelease(struct CCcontract_info *cp,char *jsonstr) mtx.vout[i+1].nValue *= amount; mtx.vout[i+1].nValue /= totalallocations; } +<<<<<<< Updated upstream +======= + //fprintf(stderr,"addinputs %.8f\n",(double)amount/COIN); +>>>>>>> Stashed changes if ( (inputsum= AddPaymentsInputs(cp,mtx,txidpk,amount+PAYMENTS_TXFEE,60,createtxid,latestheight)) >= amount ) { std::string rawtx; @@ -388,7 +407,7 @@ UniValue PaymentsRelease(struct CCcontract_info *cp,char *jsonstr) rawtx = FinalizeCCTx(0,cp,mtx,mypk,PAYMENTS_TXFEE,onlyopret); if ( params != 0 ) free_json(params); - return(payments_rawtxresult(result,rawtx,0)); + return(payments_rawtxresult(result,rawtx,1)); } else { @@ -664,7 +683,7 @@ UniValue PaymentsInfo(struct CCcontract_info *cp,char *jsonstr) return(result); } -UniValue PaymentsList(struct CCcontract_info *cp,char *jsonstr) +UniValue PaymentsList(struct CCcontract_info *cp) { std::vector > addressIndex; uint256 txid,hashBlock; UniValue result(UniValue::VOBJ),a(UniValue::VARR); char markeraddr[64],str[65]; CPubKey Paymentspk; CTransaction tx; int32_t lockedblocks,minrelease,totalallocations; std::vector txidoprets; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 062ef6148..80ad2afe0 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5653,7 +5653,7 @@ UniValue payments_list(const UniValue& params, bool fHelp) const CKeyStore& keystore = *pwalletMain; LOCK2(cs_main, pwalletMain->cs_wallet); cp = CCinit(&C,EVAL_PAYMENTS); - return(PaymentsList(cp,"")); + return(PaymentsList(cp)); } UniValue oraclesaddress(const UniValue& params, bool fHelp)