File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 12
12
#include " utilstrencodings.h"
13
13
#include " crypto/common.h"
14
14
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
+
15
19
namespace Sidechain {
16
20
namespace Bitcoin {
17
21
Original file line number Diff line number Diff line change 12
12
#include " serialize.h"
13
13
#include " uint256.h"
14
14
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
+
15
31
namespace Sidechain {
16
32
namespace Bitcoin {
17
33
@@ -48,6 +64,15 @@ class CBlockHeader
48
64
READWRITE (nTime);
49
65
READWRITE (nBits);
50
66
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
+ }
51
76
}
52
77
53
78
void SetNull ()
You can’t perform that action at this time.
0 commit comments