This commit is contained in:
jl777
2019-03-25 00:45:04 -11:00
parent 55a5f398aa
commit 62a31073c9
3 changed files with 7 additions and 6 deletions

View File

@@ -166,17 +166,17 @@ UniValue games_register(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
int32_t games_eventsign(std::vector<uint8_t> &sig,std::vector<uint8_t> payload,CPubKey pk)
{
bool signSuccess; SignatureData sigdata; uint256 hash; uint8_t *ptr; auto consensusBranchId = 0;
bool signSuccess; SignatureData sigdata; int32_t i,siglen; uint256 hash; uint8_t *ptr; auto consensusBranchId = 0; CMutableTransaction txNew;
const CKeyStore& keystore = *pwalletMain;
txNew.vin.resize(1);
txNew.vout.resize(1);
txNew.vin[0].prevout.hash = payload.GetHash();
txNew.vin[0].prevout.n = 0;
txNew.vout[0].scriptPubKey = CScript() << payload << OP_DROP << ParseHex(HexString(pk)) << OP_CHECKSIG;
txNew.vout[0].nValue = (int32_t)payload.size();
txNew.vout[0].scriptPubKey = CScript() << payload << OP_DROP << ParseHex(HexStr(pk)) << OP_CHECKSIG;
txNew.vout[0].nValue = payload.size();
txNew.nLockTime = 0;
CTransaction txNewConst(txNew);
signSuccess = ProduceSignature(TransactionSignatureCreator(&keystore, &txNewConst, 0, *utxovaluep, SIGHASH_ALL), txNew.vout[0].scriptPubKey, sigdata, consensusBranchId);
signSuccess = ProduceSignature(TransactionSignatureCreator(&keystore, &txNewConst, 0, payload.size(), SIGHASH_ALL), txNew.vout[0].scriptPubKey, sigdata, consensusBranchId);
if ( signSuccess > 0 )
{
UpdateTransaction(txNew,0,sigdata);

View File

@@ -1,3 +1,4 @@
#include "CCinclud.h"
std::string MYCCLIBNAME = (char *)"gamescc";

View File

@@ -569,7 +569,7 @@ UniValue PaymentsRelease(struct CCcontract_info *cp,char *jsonstr)
UniValue PaymentsFund(struct CCcontract_info *cp,char *jsonstr)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); UniValue result(UniValue::VOBJ);
CPubKey Paymentspk,mypk,txidpk; uint256 txid,hashBlock; int64_t amount; CScript opret; CTransaction tx; char txidaddr[64]; std::string rawtx; int32_t n,useopret = 0,lockedblocks,minrelease,totalallocations; std::vector<uint256> txidoprets;
CPubKey Paymentspk,mypk,txidpk; uint256 txid,hashBlock; int64_t amount,totalallocations; CScript opret; CTransaction tx; char txidaddr[64]; std::string rawtx; int32_t n,useopret = 0,lockedblocks,minrelease; std::vector<uint256> txidoprets;
cJSON *params = payments_reparse(&n,jsonstr);
mypk = pubkey2pk(Mypubkey());
Paymentspk = GetUnspendable(cp,0);
@@ -662,7 +662,7 @@ UniValue PaymentsTxidopret(struct CCcontract_info *cp,char *jsonstr)
UniValue PaymentsCreate(struct CCcontract_info *cp,char *jsonstr)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
UniValue result(UniValue::VOBJ); CTransaction tx; CPubKey Paymentspk,mypk; char markeraddr[64]; std::vector<uint256> txidoprets; uint256 hashBlock; int32_t i,n,numoprets=0,lockedblocks,minrelease,totalallocations=0; std::string rawtx;
UniValue result(UniValue::VOBJ); CTransaction tx; CPubKey Paymentspk,mypk; char markeraddr[64]; std::vector<uint256> txidoprets; uint256 hashBlock; int32_t i,n,numoprets=0,lockedblocks,minrelease; std::string rawtx; int64_t totalallocations = 0;
cJSON *params = payments_reparse(&n,jsonstr);
if ( params != 0 && n >= 4 )
{