From 6477e13920bfd77bf1bedce869a077ab2ba49adb Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 5 Sep 2012 03:01:49 +0000 Subject: [PATCH] Add usage of "maxversion" request, and update capability enum for version/* mutations --- blkmaker.h | 1 + blkmaker_jansson.c | 5 +++++ blktemplate.h | 16 +++++++++------- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/blkmaker.h b/blkmaker.h index 22ac857..3a78451 100644 --- a/blkmaker.h +++ b/blkmaker.h @@ -6,6 +6,7 @@ #include #define BLKMAKER_VERSION (0L) +#define BLKMAKER_MAX_BLOCK_VERSION (2) extern bool (*blkmk_sha256_impl)(void *hash_out, const void *data, size_t datasz); diff --git a/blkmaker_jansson.c b/blkmaker_jansson.c index c6ac137..5c87650 100644 --- a/blkmaker_jansson.c +++ b/blkmaker_jansson.c @@ -7,6 +7,7 @@ #include +#include #include #ifndef JSON_INTEGER_IS_LONG_LONG @@ -38,6 +39,10 @@ json_t *blktmpl_request_jansson(gbt_capabilities_t caps) { if (json_object_set_new(req, "capabilities", jcaps)) goto err; jcaps = NULL; + if (!(jstr = json_integer(BLKMAKER_MAX_BLOCK_VERSION))) + goto err; + if (json_object_set_new(req, "maxversion", jstr)) + goto err; if (json_object_set_new(reqf, "id", jstr)) goto err; if (!(jstr = json_string("getblocktemplate"))) diff --git a/blktemplate.h b/blktemplate.h index c273b12..2636dc7 100644 --- a/blktemplate.h +++ b/blktemplate.h @@ -50,16 +50,18 @@ typedef enum { BMM_TIMEDEC = 1 << 0x14, BMM_TXNADD = 1 << 0x15, BMM_PREVBLK = 1 << 0x16, + BMM_VERFORCE = 1 << 0x17, + BMM_VERDROP = 1 << 0x18, // BIP 23: Submission Abbreviation - BMA_TXNHASH = 1 << 0x18, - BMAb_COINBASE = 1 << 0x19, - BMAb_TRUNCATE = 1 << 0x1a, - BMAs_COINBASE = 1 << 0x1b, - BMAs_MERKLE = 1 << 0x1c, - BMAs_TRUNCATE = 1 << 0x1d, + BMA_TXNHASH = 1 << 0x19, + BMAb_COINBASE = 1 << 0x1a, + BMAb_TRUNCATE = 1 << 0x1b, + BMAs_COINBASE = 1 << 0x1c, + BMAs_MERKLE = 1 << 0x1d, + BMAs_TRUNCATE = 1 << 0x1e, } gbt_capabilities_t; -#define GBT_CAPABILITY_COUNT (0x1e) +#define GBT_CAPABILITY_COUNT (0x1f) extern const char *blktmpl_capabilityname(gbt_capabilities_t); #define BLKTMPL_LONGEST_CAPABILITY_NAME (16)