Self-contained test case that finds a share quickly with libgcrypt CPU miner
This commit is contained in:
10
example.c
10
example.c
@@ -9,6 +9,8 @@
|
|||||||
#include <blkmaker.h>
|
#include <blkmaker.h>
|
||||||
#include <blkmaker_jansson.h>
|
#include <blkmaker_jansson.h>
|
||||||
|
|
||||||
|
#include "testinput.c"
|
||||||
|
|
||||||
static
|
static
|
||||||
void send_json(json_t *req) {
|
void send_json(json_t *req) {
|
||||||
char *s = json_dumps(req, JSON_INDENT(2));
|
char *s = json_dumps(req, JSON_INDENT(2));
|
||||||
@@ -38,7 +40,13 @@ int main(int argc, char**argv) {
|
|||||||
// send req to server and parse response into req
|
// send req to server and parse response into req
|
||||||
send_json(req);
|
send_json(req);
|
||||||
json_decref(req);
|
json_decref(req);
|
||||||
req = json_loadf(stdin, JSON_DISABLE_EOF_CHECK, &jsone);
|
if (argc == 2)
|
||||||
|
req = json_loadf(stdin, JSON_DISABLE_EOF_CHECK, &jsone);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
req = json_loads(blkmaker_test_input, 0, &jsone);
|
||||||
|
send_json(req);
|
||||||
|
}
|
||||||
assert(req);
|
assert(req);
|
||||||
|
|
||||||
err = blktmpl_add_jansson(tmpl, req, time(NULL));
|
err = blktmpl_add_jansson(tmpl, req, time(NULL));
|
||||||
|
|||||||
37
testinput.c
Normal file
37
testinput.c
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
const char *blkmaker_test_input =
|
||||||
|
"{"
|
||||||
|
"\"result\": {"
|
||||||
|
"\"previousblockhash\": \"000000004d424dec1c660a68456b8271d09628a80cc62583e5904f5894a2483c\","
|
||||||
|
"\"target\": \"00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff\","
|
||||||
|
"\"noncerange\": \"00000000ffffffff\","
|
||||||
|
"\"transactions\": [],"
|
||||||
|
"\"sigoplimit\": 20000,"
|
||||||
|
"\"expires\": 120,"
|
||||||
|
"\"longpoll\": \"/LP\","
|
||||||
|
"\"height\": 23957,"
|
||||||
|
"\"coinbasetxn\": {"
|
||||||
|
"\"data\": \""
|
||||||
|
"01000000" // txn version
|
||||||
|
"01" // txn in count
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000000" // input coin
|
||||||
|
"ffffffff"
|
||||||
|
"13" "02955d0f00456c6967697573005047dc66085f" // scriptSig
|
||||||
|
"ffffffff" // sequence
|
||||||
|
"02" // tx out count
|
||||||
|
"fff1052a01000000" // tx out #1 amount
|
||||||
|
"19" "76a9144ebeb1cd26d6227635828d60d3e0ed7d0da248fb88ac" // tx out #1 scriptPubKey
|
||||||
|
"0100000000000000" // tx out #2 amount
|
||||||
|
"19" "76a9147c866aee1fa2f3b3d5effad576df3dbf1f07475588ac" // tx out #2 scriptPubKey
|
||||||
|
"00000000" // lock time
|
||||||
|
"\""
|
||||||
|
"},"
|
||||||
|
"\"version\": 2,"
|
||||||
|
"\"curtime\": 1346886758,"
|
||||||
|
"\"mutable\": [\"coinbase/append\"],"
|
||||||
|
"\"sizelimit\": 1000000,"
|
||||||
|
"\"bits\": \"1d00ffff\""
|
||||||
|
"},"
|
||||||
|
"\"id\": 2,"
|
||||||
|
"\"error\": null"
|
||||||
|
"}"
|
||||||
|
;
|
||||||
Reference in New Issue
Block a user