pool/stratum/coind.h
Tanguy Pruvot cbe55a3a84 Squashed commit for segwit support:
commit c59abe5d203fabdabcca81ff5f9c6ff133cfae3b
Author: Tanguy Pruvot <tanguy.pruvot@gmail.com>
Date:   Tue Nov 28 11:13:52 2017 +0100

    segwit: show a segwit icon on blocks history

    + remove some inline styles...

commit b4a8639370e6837ebc5a2047e7c334e9f931abfc
Author: Tanguy Pruvot <tanguy.pruvot@gmail.com>
Date:   Tue Nov 28 09:55:40 2017 +0100

    segwit: cleanup + masternode case

    tested ok with BSD (block 400996), and with real BTX segwit txs (block 90958)

    also ok on VTC and GRS

commit 926dbd11757ebff7f7d4930266de9b9061c8ab16
Author: Tanguy Pruvot <tanguy.pruvot@gmail.com>
Date:   Sat Nov 25 18:41:01 2017 +0100

    sql: add segwit fields, and ui config

    and fill block segwit field if it contains segwit txs,
    an icon is added in the dashboard "last blocks" for these blocks

commit 0b13bf55e9dd1d2229d188f0f8382b27642b20da
Author: Tanguy Pruvot <tanguy.pruvot@gmail.com>
Date:   Sat Nov 25 13:47:20 2017 +0100

    segwit: include commitment in coinbase + .conf toggle

    tested ok on BTX, GRS and VTC with normal txs, but the commitment merkle hash maybe need some more love...

    so, to prevent useless bigger blocks, only generate segwit commitment if a segwit tx is present in mempool

    to check with real segwit txs... not seen any yet..

commit b508bc87943d9e426cda994c2f53c16c11e8d4c3
Author: Tanguy Pruvot <tanguy.pruvot@gmail.com>
Date:   Thu Mar 2 11:18:34 2017 +0100

    segwit: prepare the witness data, but disabled

    need more test, may affect the coinbase merkle and the miners...

commit 19bd3a83b9ddddd8b5ed4b7a1bdf8cf8c233e346
Author: Tanguy Pruvot <tanguy.pruvot@gmail.com>
Date:   Thu Mar 2 10:30:29 2017 +0100

    stratum: handle and auto toggle segwit if supported
2017-11-28 11:55:20 +01:00

111 lines
2 KiB
C++

struct YAAMP_COIND_AUX
{
YAAMP_COIND *coind;
// int height;
int index;
int chainid;
char hash[1024];
char target[1024];
};
class YAAMP_COIND: public YAAMP_OBJECT
{
public:
bool touch;
bool newcoind;
YAAMP_RPC rpc;
char rpcencoding[32];
// pthread_t thread;
pthread_mutex_t mutex;
// pthread_cond_t cond;
// bool closing;
char name[1024];
char symbol[256];
char symbol2[256];
char algo[256];
char wallet[1024];
char account[256];
char pubkey[1024];
char script_pubkey[1024];
bool pos;
bool hassubmitblock;
bool txmessage;
char charity_address[1024];
double charity_amount;
double charity_percent;
bool enable;
bool auto_ready;
bool newblock;
int height;
double difficulty;
double reward;
double reward_mul;
double price;
int pool_ttf;
int actual_ttf;
bool isaux;
YAAMP_COIND_AUX aux;
int notreportingcounter;
bool usegetwork;
bool usememorypool;
bool hasmasternodes;
bool noblocknotify;
bool multialgos; // pow_hash field (or mined_hash)
bool usesegwit;
char commitment[128];
char witness_magic[16];
YAAMP_JOB *job;
// YAAMP_JOB_TEMPLATE *templ;
};
//////////////////////////////////////////////////////////////////////////
inline void coind_delete(YAAMP_OBJECT *object)
{
YAAMP_COIND *coind = (YAAMP_COIND *)object;
object_delete(coind->job);
// if(coind->templ) delete coind->templ;
delete coind;
}
void coind_error(YAAMP_COIND *coind, const char *s);
double coind_profitability(YAAMP_COIND *coind);
double coind_nethash(YAAMP_COIND *coind);
bool coind_can_mine(YAAMP_COIND *coind, bool isaux=false);
void coind_sort();
bool coind_submit(YAAMP_COIND *coind, const char *block);
bool coind_submitgetauxblock(YAAMP_COIND *coind, const char *hash, const char *block);
void coind_init(YAAMP_COIND *coind);
void coind_terminate(YAAMP_COIND *coind);
//void coind_getauxblock(YAAMP_COIND *coind);
bool coind_create_job(YAAMP_COIND *coind, bool force=false);
bool coind_validate_user_address(YAAMP_COIND *coind, char* const address);