From 2d16b4dbe69acf0411bc3311b3fc328aa3bc1c6b Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 12 Sep 2018 05:13:00 -1100 Subject: [PATCH] Test --- src/cc/gateways.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/cc/gateways.cpp b/src/cc/gateways.cpp index 6450b3c90..7f639d4ba 100644 --- a/src/cc/gateways.cpp +++ b/src/cc/gateways.cpp @@ -130,7 +130,6 @@ string oracles gatewayspending will display all pending withdraws and if it is done on one of the msigpubkeys, then it will queue it for processing ./c gatewayspending e6c99f79d4afb216aa8063658b4222edb773dd24bb0f8e91bd4ef341f3e47e5e KMD - */ @@ -139,6 +138,13 @@ int32_t GatewaysAddQueue(std::string coin,uint256 txid,CScript scriptPubKey,int6 char destaddr[64],str[65]; Getscriptaddress(destaddr,scriptPubKey); fprintf(stderr,"GatewaysAddQueue: %s %s %s %.8f\n",coin.c_str(),uint256_str(str,txid),destaddr,(double)nValue/COIN); + // check queue to prevent duplicate + // check KMD chain and mempool for txidaddr + // if txidaddr exists properly, spend the marker (txid.2) + // create withdraw tx and sign it + // if enough sigs, sendrawtransaction and when it confirms spend marker (txid.2) + /// if not enough sigs, post partially signed to acname with marker2 + /// monitor marker2, for the partially signed withdraws } // start of consensus code @@ -766,7 +772,7 @@ std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin) { - UniValue result(UniValue::VOBJ),pending(UniValue::VARR),obj(UniValue::VOBJ); CTransaction tx; std::string coin; CPubKey mypk,gatewayspk; std::vector msigpubkeys; uint256 hashBlock,assetid,txid,oracletxid; uint8_t M,N,taddr,prefix,prefix2; char depositaddr[64],withmarker[64],coinaddr[64],destaddr[64],str[65],withaddr[64],numstr[32]; int32_t i,n,numvouts,vout,numqueued,queueflag; int64_t totalsupply; struct CCcontract_info *cp,C; + UniValue result(UniValue::VOBJ),pending(UniValue::VARR),obj(UniValue::VOBJ); CTransaction tx; std::string coin; CPubKey mypk,gatewayspk; std::vector msigpubkeys; uint256 hashBlock,assetid,txid,oracletxid; uint8_t M,N,taddr,prefix,prefix2; char depositaddr[64],withmarker[64],coinaddr[64],destaddr[64],str[65],withaddr[64],numstr[32],txidaddr[64]; int32_t i,n,numvouts,vout,numqueued,queueflag; int64_t totalsupply; struct CCcontract_info *cp,C; std::vector > unspentOutputs; cp = CCinit(&C,EVAL_GATEWAYS); mypk = pubkey2pk(Mypubkey()); @@ -804,12 +810,14 @@ UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin) if ( strcmp(destaddr,coinaddr) == 0 ) { obj.push_back(Pair("txid",uint256_str(str,txid))); + CCtxidaddr(txidaddr,txid); + obj.push_back(Pair("txidaddr",txidaddr)); obj.push_back(Pair("withdrawaddr",withaddr)); sprintf(numstr,"%.8f",(double)tx.vout[0].nValue/COIN); obj.push_back(Pair("amount",numstr)); pending.push_back(obj); - if ( queueflag != 0 ) - numqueued += GatewaysAddQueue(refcoin,txid,tx.vout[1].scriptPubKey,tx.vout[0].nValue); + //if ( queueflag != 0 ) + // numqueued += GatewaysAddQueue(refcoin,txid,tx.vout[1].scriptPubKey,tx.vout[0].nValue); } } }