File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1212#include " utilstrencodings.h"
1313#include " crypto/common.h"
1414
15+ bool g_solution_blocks = false ;
16+ size_t g_solution_block_len = 0 ;
17+ std::map<uint256,std::vector<uint8_t >> g_blockheader_payload_map;
18+
1519namespace Sidechain {
1620namespace Bitcoin {
1721
Original file line number Diff line number Diff line change 1212#include " serialize.h"
1313#include " uint256.h"
1414
15+ /* *
16+ * If true, block headers contain a payload equal to a Bitcoin Script solution
17+ * to a signet challenge as defined in the chain params.
18+ */
19+ extern bool g_solution_blocks;
20+ /* *
21+ * If non-zero, defines an enforced size requirement for block header payloads.
22+ * It requires that all blocks are of size 80 + (this value) bytes.
23+ */
24+ extern size_t g_solution_block_len;
25+ /* *
26+ * Contains a mapping of hash to signature data for each block header
27+ * in signet networks.
28+ */
29+ extern std::map<uint256,std::vector<uint8_t >> g_blockheader_payload_map;
30+
1531namespace Sidechain {
1632namespace Bitcoin {
1733
@@ -48,6 +64,15 @@ class CBlockHeader
4864 READWRITE (nTime);
4965 READWRITE (nBits);
5066 READWRITE (nNonce);
67+ if (g_solution_blocks && !(s.GetType () & SER_GETHASH)) {
68+ READWRITE (g_blockheader_payload_map[GetHash ()]);
69+ size_t len = GetSizeOfCompactSize (g_blockheader_payload_map[GetHash ()].size ()) + g_blockheader_payload_map[GetHash ()].size ();
70+ while (len < g_solution_block_len) {
71+ uint8_t padding = 0 ;
72+ READWRITE (padding);
73+ len++;
74+ }
75+ }
5176 }
5277
5378 void SetNull ()
You can’t perform that action at this time.
0 commit comments