Merge branch 'master' of https://bitbucket.org/ckolivas/ckpool
This commit is contained in:
commit
580cf3a2b2
@ -1,4 +1,4 @@
|
||||
AC_INIT(ckpool, 0.8.7, kernel@kolivas.org)
|
||||
AC_INIT(ckpool, 0.8.8, kernel@kolivas.org)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
@ -1619,9 +1619,8 @@ char *http_base64(const char *src)
|
||||
|
||||
void address_to_pubkeytxn(char *pkh, const char *addr)
|
||||
{
|
||||
char b58bin[25];
|
||||
char b58bin[25] = {};
|
||||
|
||||
memset(b58bin, 0, 25);
|
||||
b58tobin(b58bin, addr);
|
||||
pkh[0] = 0x76;
|
||||
pkh[1] = 0xa9;
|
||||
@ -1631,6 +1630,17 @@ void address_to_pubkeytxn(char *pkh, const char *addr)
|
||||
pkh[24] = 0xac;
|
||||
}
|
||||
|
||||
void address_to_scripttxn(char *pkh, const char *addr)
|
||||
{
|
||||
char b58bin[25] = {};
|
||||
|
||||
b58tobin(b58bin, addr);
|
||||
pkh[0] = 0xa9;
|
||||
pkh[1] = 0x14;
|
||||
memcpy(&pkh[2], &b58bin[1], 20);
|
||||
pkh[22] = 0x87;
|
||||
}
|
||||
|
||||
/* For encoding nHeight into coinbase, return how many bytes were used */
|
||||
int ser_number(uchar *s, int32_t val)
|
||||
{
|
||||
|
||||
@ -537,6 +537,7 @@ int safecmp(const char *a, const char *b);
|
||||
bool cmdmatch(const char *buf, const char *cmd);
|
||||
|
||||
void address_to_pubkeytxn(char *pkh, const char *addr);
|
||||
void address_to_scripttxn(char *pkh, const char *addr);
|
||||
int ser_number(uchar *s, int32_t val);
|
||||
int get_sernumber(uchar *s);
|
||||
bool fulltest(const uchar *hash, const uchar *target);
|
||||
|
||||
@ -330,7 +330,9 @@ static const char *ckdb_seq_names[] = {
|
||||
|
||||
struct stratifier_data {
|
||||
char pubkeytxnbin[25];
|
||||
int pubkeytxnlen;
|
||||
char donkeytxnbin[25];
|
||||
int donkeytxnlen;
|
||||
|
||||
pool_stats_t stats;
|
||||
/* Protects changes to pool stats */
|
||||
@ -542,18 +544,18 @@ static void generate_coinbase(const ckpool_t *ckp, workbase_t *wb)
|
||||
*u64 = htole64(g64);
|
||||
wb->coinb2len += 8;
|
||||
|
||||
wb->coinb2bin[wb->coinb2len++] = 25;
|
||||
memcpy(wb->coinb2bin + wb->coinb2len, sdata->pubkeytxnbin, 25);
|
||||
wb->coinb2len += 25;
|
||||
wb->coinb2bin[wb->coinb2len++] = sdata->pubkeytxnlen;
|
||||
memcpy(wb->coinb2bin + wb->coinb2len, sdata->pubkeytxnbin, sdata->pubkeytxnlen);
|
||||
wb->coinb2len += sdata->pubkeytxnlen;
|
||||
|
||||
if (ckp->donvalid) {
|
||||
u64 = (uint64_t *)&wb->coinb2bin[wb->coinb2len];
|
||||
*u64 = htole64(d64);
|
||||
wb->coinb2len += 8;
|
||||
|
||||
wb->coinb2bin[wb->coinb2len++] = 25;
|
||||
memcpy(wb->coinb2bin + wb->coinb2len, sdata->donkeytxnbin, 25);
|
||||
wb->coinb2len += 25;
|
||||
wb->coinb2bin[wb->coinb2len++] = sdata->donkeytxnlen;
|
||||
memcpy(wb->coinb2bin + wb->coinb2len, sdata->donkeytxnbin, sdata->donkeytxnlen);
|
||||
wb->coinb2len += sdata->donkeytxnlen;
|
||||
}
|
||||
|
||||
wb->coinb2len += 4; // Blank lock
|
||||
@ -4456,6 +4458,13 @@ static void read_poolstats(ckpool_t *ckp)
|
||||
}
|
||||
}
|
||||
|
||||
/* Braindead check to see if this btcaddress is an M of N script address which
|
||||
* is currently unsupported as a generation address. */
|
||||
static bool script_address(const char *btcaddress)
|
||||
{
|
||||
return btcaddress[0] == '3';
|
||||
}
|
||||
|
||||
int stratifier(proc_instance_t *pi)
|
||||
{
|
||||
pthread_t pth_blockupdate, pth_statsupdate, pth_heartbeat;
|
||||
@ -4486,11 +4495,23 @@ int stratifier(proc_instance_t *pi)
|
||||
|
||||
/* Store this for use elsewhere */
|
||||
hex2bin(scriptsig_header_bin, scriptsig_header, 41);
|
||||
address_to_pubkeytxn(sdata->pubkeytxnbin, ckp->btcaddress);
|
||||
if (script_address(ckp->btcaddress)) {
|
||||
address_to_scripttxn(sdata->pubkeytxnbin, ckp->btcaddress);
|
||||
sdata->pubkeytxnlen = 23;
|
||||
} else {
|
||||
address_to_pubkeytxn(sdata->pubkeytxnbin, ckp->btcaddress);
|
||||
sdata->pubkeytxnlen = 25;
|
||||
}
|
||||
|
||||
if (test_address(ckp, ckp->donaddress)) {
|
||||
ckp->donvalid = true;
|
||||
address_to_pubkeytxn(sdata->donkeytxnbin, ckp->donaddress);
|
||||
if (script_address(ckp->donaddress)) {
|
||||
sdata->donkeytxnlen = 23;
|
||||
address_to_scripttxn(sdata->donkeytxnbin, ckp->donaddress);
|
||||
} else {
|
||||
sdata->donkeytxnlen = 25;
|
||||
address_to_pubkeytxn(sdata->donkeytxnbin, ckp->donaddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user