Merge remote-tracking branch 'origin/jl777' into jl777

This commit is contained in:
jl777
2019-05-08 21:57:47 -11:00
3 changed files with 23 additions and 13 deletions

View File

@@ -19,6 +19,7 @@
#include "CCinclude.h" #include "CCinclude.h"
#include <gmp.h> #include <gmp.h>
#include <key_io.h>
#define PAYMENTS_TXFEE 10000 #define PAYMENTS_TXFEE 10000
#define PAYMENTS_MERGEOFSET 10 // 100? #define PAYMENTS_MERGEOFSET 10 // 100?

View File

@@ -1208,16 +1208,22 @@ UniValue PaymentsAirdrop(struct CCcontract_info *cp,char *jsonstr)
{ {
for (i=0; i<n-6; i++) for (i=0; i<n-6; i++)
{ {
/* TODO: Change this RPC to take an address. Because a tokens airdrop needs its own RPC anyway. std::string address;
CTxDestination destination = DecodeDestination(name_); address.append(jstri(params,6+i));
CTxDestination destination = DecodeDestination(address);
if (!IsValidDestination(destination))
{
result.push_back(Pair("result","error"));
result.push_back(Pair("error","address is not valid."));
result.push_back(Pair("invalid_address",address));
if ( params != 0 )
free_json(params);
return(result);
}
std::vector<uint8_t> vscriptPubKey;
CScript scriptPubKey = GetScriptForDestination(destination); CScript scriptPubKey = GetScriptForDestination(destination);
*/ vscriptPubKey.assign(scriptPubKey.begin(), scriptPubKey.end());
char *inputhex = jstri(params,6+i); excludeScriptPubKeys.push_back(vscriptPubKey);
std::vector<uint8_t> scriptPubKey;
int32_t len = strlen(inputhex)/2;
scriptPubKey.resize(len);
decode_hex((uint8_t *)scriptPubKey.data(),len,(char *)inputhex);
excludeScriptPubKeys.push_back(scriptPubKey);
} }
} }
mypk = pubkey2pk(Mypubkey()); mypk = pubkey2pk(Mypubkey());
@@ -1331,10 +1337,13 @@ UniValue PaymentsInfo(struct CCcontract_info *cp,char *jsonstr)
result.push_back(Pair("bottom",(int64_t)bottom)); result.push_back(Pair("bottom",(int64_t)bottom));
result.push_back(Pair("top",(int64_t)top)); result.push_back(Pair("top",(int64_t)top));
result.push_back(Pair("fixedFlag",(int64_t)fixedAmount)); result.push_back(Pair("fixedFlag",(int64_t)fixedAmount));
// TODO: convert to show addresses instead of scriptpubkey.
for ( auto scriptPubKey : excludeScriptPubKeys ) for ( auto scriptPubKey : excludeScriptPubKeys )
a.push_back(HexStr(scriptPubKey.begin(),scriptPubKey.end())); {
result.push_back(Pair("excludeScriptPubkeys",a)); CTxDestination dest;
if ( ExtractDestination(CScript(scriptPubKey.begin(),scriptPubKey.end()), dest) )
a.push_back(CBitcoinAddress(dest).ToString());
}
result.push_back(Pair("excludeAddresses",a));
} }
else if ( DecodePaymentsTokensOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,lockedblocks,minrelease,top,excludeScriptPubKeys,tokenid) != 0 ) else if ( DecodePaymentsTokensOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,lockedblocks,minrelease,top,excludeScriptPubKeys,tokenid) != 0 )
{ {

View File

@@ -731,7 +731,7 @@ bool komodo_dailysnapshot(int32_t height)
std::sort(vAddressSnapshot.rbegin(), vAddressSnapshot.rend()); std::sort(vAddressSnapshot.rbegin(), vAddressSnapshot.rend());
//for (int j = 0; j < 50; j++) //for (int j = 0; j < 50; j++)
// fprintf(stderr, "j.%i address.%s nValue.%li\n",j, CBitcoinAddress(vAddressSnapshot[j].second).ToString().c_str(), vAddressSnapshot[j].first ); // fprintf(stderr, "j.%i address.%s nValue.%li\n",j, CBitcoinAddress(vAddressSnapshot[j].second).ToString().c_str(), vAddressSnapshot[j].first );
// include only top 5000 address. // include only top 3999 address.
if ( vAddressSnapshot.size() > 3999 ) vAddressSnapshot.resize(3999); if ( vAddressSnapshot.size() > 3999 ) vAddressSnapshot.resize(3999);
lastSnapShotHeight = undo_height; lastSnapShotHeight = undo_height;
fprintf(stderr, "vAddressSnapshot.size.%li\n", vAddressSnapshot.size()); fprintf(stderr, "vAddressSnapshot.size.%li\n", vAddressSnapshot.size());