Sudokupk signing
This commit is contained in:
@@ -502,7 +502,7 @@ CScript sudoku_genopret(uint8_t unsolved[9][9])
|
||||
UniValue sudoku_generate(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
UniValue result(UniValue::VOBJ); CPubKey sudokupk,pk; uint8_t privkey[32],unsolved[9][9],pub33[33]; uint32_t srandi; uint256 hash; char coinaddr[64]; uint64_t inputsum,amount; std::string rawtx;
|
||||
UniValue result(UniValue::VOBJ); CPubKey sudokupk,pk; uint8_t privkey[32],unsolved[9][9],pub33[33]; uint32_t srandi; uint256 hash; char coinaddr[64]; uint64_t inputsum,amount,change=0; std::string rawtx;
|
||||
if ( params != 0 )
|
||||
{
|
||||
printf("params.(%s)\n",jprint(params,0));
|
||||
@@ -523,7 +523,12 @@ UniValue sudoku_generate(uint64_t txfee,struct CCcontract_info *cp,cJSON *params
|
||||
if ( (inputsum= AddCClibInputs(cp,mtx,sudokupk,amount+2*txfee,16)) >= amount+2*txfee )
|
||||
{
|
||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,sudokupk));
|
||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,inputsum - 2*txfee,pk));
|
||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,amount,pk));
|
||||
if ( inputsum > amount + 2*txfee )
|
||||
change = (inputsum - amount - 2*txfee);
|
||||
if ( change > txfee )
|
||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,change,sudokupk));
|
||||
CCaddr2set(cp,cp->evalcode,sudokupk,cp->CCpriv,cp->CCaddr);
|
||||
rawtx = FinalizeCCTx(0,cp,mtx,sudokupk,txfee,sudoku_genopret(unsolved));
|
||||
result.push_back(Pair("hex",rawtx));
|
||||
} else result.push_back(Pair("error","not enough SUDOKU funds"));
|
||||
|
||||
@@ -5240,7 +5240,10 @@ UniValue CCaddress(struct CCcontract_info *cp,char *name,std::vector<unsigned ch
|
||||
result.push_back(Pair("myCCbalance",ValueFromAmount(CCaddress_balance(destaddr))));
|
||||
}
|
||||
if ( Getscriptaddress(destaddr,(CScript() << Mypubkey() << OP_CHECKSIG)) != 0 )
|
||||
{
|
||||
result.push_back(Pair("myaddress",destaddr));
|
||||
result.push_back(Pair("mybalance",ValueFromAmount(CCaddress_balance(destaddr))));
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user