mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-04 21:05:14 +00:00
stratum: common p2sh_pack_tx func for p2sh masternodes
This commit is contained in:
parent
ed97818e61
commit
b114a1c66f
1 changed files with 15 additions and 18 deletions
|
@ -32,6 +32,19 @@ static void job_pack_tx(YAAMP_COIND *coind, char *data, json_int_t amount, char
|
||||||
// debuglog("pack tx %lld\n", amount);
|
// debuglog("pack tx %lld\n", amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void p2sh_pack_tx(YAAMP_COIND *coind, char *data, json_int_t amount, char *payee)
|
||||||
|
{
|
||||||
|
char evalue[32];
|
||||||
|
char coinb2_part[256];
|
||||||
|
char coinb2_len[4];
|
||||||
|
sprintf(coinb2_part, "a9%02x%s87", (unsigned int)(strlen(payee) >> 1) & 0xFF, payee);
|
||||||
|
sprintf(coinb2_len, "%02x", (unsigned int)(strlen(coinb2_part) >> 1) & 0xFF);
|
||||||
|
encode_tx_value(evalue, amount);
|
||||||
|
strcat(data, evalue);
|
||||||
|
strcat(data, coinb2_len);
|
||||||
|
strcat(data, coinb2_part);
|
||||||
|
}
|
||||||
|
|
||||||
void coinbase_aux(YAAMP_JOB_TEMPLATE *templ, char *aux_script)
|
void coinbase_aux(YAAMP_JOB_TEMPLATE *templ, char *aux_script)
|
||||||
{
|
{
|
||||||
vector<string> hashlist = coind_aux_hashlist(templ->auxs, templ->auxs_size);
|
vector<string> hashlist = coind_aux_hashlist(templ->auxs, templ->auxs_size);
|
||||||
|
@ -298,15 +311,7 @@ void coinbase_create(YAAMP_COIND *coind, YAAMP_JOB_TEMPLATE *templ, json_value *
|
||||||
base58_decode(payee, script_payee);
|
base58_decode(payee, script_payee);
|
||||||
bool superblock_use_p2sh = (strcmp(coind->symbol, "MAC") == 0);
|
bool superblock_use_p2sh = (strcmp(coind->symbol, "MAC") == 0);
|
||||||
if(superblock_use_p2sh) {
|
if(superblock_use_p2sh) {
|
||||||
char eamount[32] = { 0 };
|
p2sh_pack_tx(coind, script_dests, amount, script_payee);
|
||||||
char coinb2_part[256];
|
|
||||||
char coinb2_len[4];
|
|
||||||
sprintf(coinb2_part, "a9%02x%s87", (unsigned int)(strlen(script_payee) >> 1) & 0xFF, script_payee);
|
|
||||||
sprintf(coinb2_len, "%02x", (unsigned int)(strlen(coinb2_part) >> 1) & 0xFF);
|
|
||||||
encode_tx_value(eamount, amount);
|
|
||||||
strcat(script_dests, eamount);
|
|
||||||
strcat(script_dests, coinb2_len);
|
|
||||||
strcat(script_dests, coinb2_part);
|
|
||||||
} else {
|
} else {
|
||||||
job_pack_tx(coind, script_dests, amount, script_payee);
|
job_pack_tx(coind, script_dests, amount, script_payee);
|
||||||
}
|
}
|
||||||
|
@ -323,15 +328,7 @@ void coinbase_create(YAAMP_COIND *coind, YAAMP_JOB_TEMPLATE *templ, json_value *
|
||||||
base58_decode(payee, script_payee);
|
base58_decode(payee, script_payee);
|
||||||
bool masternode_use_p2sh = (strcmp(coind->symbol, "MAC") == 0);
|
bool masternode_use_p2sh = (strcmp(coind->symbol, "MAC") == 0);
|
||||||
if(masternode_use_p2sh) {
|
if(masternode_use_p2sh) {
|
||||||
char eamount[32] = { 0 };
|
p2sh_pack_tx(coind, script_dests, amount, script_payee);
|
||||||
char coinb2_part[256];
|
|
||||||
char coinb2_len[4];
|
|
||||||
sprintf(coinb2_part, "a9%02x%s87", (unsigned int)(strlen(script_payee) >> 1) & 0xFF, script_payee);
|
|
||||||
sprintf(coinb2_len, "%02x", (unsigned int)(strlen(coinb2_part) >> 1) & 0xFF);
|
|
||||||
encode_tx_value(eamount, amount);
|
|
||||||
strcat(script_dests, eamount);
|
|
||||||
strcat(script_dests, coinb2_len);
|
|
||||||
strcat(script_dests, coinb2_part);
|
|
||||||
} else {
|
} else {
|
||||||
job_pack_tx(coind, script_dests, amount, script_payee);
|
job_pack_tx(coind, script_dests, amount, script_payee);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue