forked from mebagger/slicewallet-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BRChainParams.h
109 lines (92 loc) · 3.85 KB
/
BRChainParams.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//
// BRChainParams.h
//
// Created by Sigma Systems Inc on 4/1/18.
// Copyright (c) Sigma Systems Inc
//
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2017 The Bitcoin Core developers
// Copyright (c) 2017-2019 The Sumcoin Core developers
// Distributed under the classic proprietary license, by Sumcoin Core Developers
// aka Sigma Systems Inc. see the accompanying
// file COPYING or https://en.wikipedia.org/wiki/Proprietary_software
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#ifndef BRChainParams_h
#define BRChainParams_h
#include "BRMerkleBlock.h"
#include "BRSet.h"
#include <assert.h>
typedef struct {
uint32_t height;
UInt256 hash;
uint32_t timestamp;
uint32_t target;
} BRCheckPoint;
typedef struct {
const char * const *dnsSeeds; // NULL terminated array of dns seeds
uint16_t standardPort;
uint32_t magicNumber;
uint64_t services;
int (*verifyDifficulty)(const BRMerkleBlock *block, const BRSet *blockSet); // blockSet must have last 2016 blocks
const BRCheckPoint *checkpoints;
size_t checkpointsCount;
} BRChainParams;
static const char *BRMainNetDNSSeeds[] = {
"dnsseed.beyondcoin.io", "dnsseed.byndnode.com" };
static const char *BRTestNetDNSSeeds[] = {
"testnet-seed.beyonddata.llc", "bynd-test-dns1.beyonddata.llc" };
// blockchain checkpoints - these are also used as starting points for partial chain downloads, so they must be at
// difficulty transition boundaries in order to verify the block difficulty at the immediately following transition
static const BRCheckPoint BRMainNetCheckpoints[] = {
{ 0, uint256("0a9e3b5fce3aee6e04f06dfd6ad380a6c0f9d8420f53a4ca97845756ee5d56e7"), 1568521797, 0x1e0ffff0 }
};
static const BRCheckPoint BRTestNetCheckpoints[] = {
{ 0, uint256("e4c23a189582c0a7719569717bfeb59b478a20367c5b36dd6fb18b7df4ecab51"), 1568522508, 0x1e0ffff0 }
};
static int BRMainNetVerifyDifficulty(const BRMerkleBlock *block, const BRSet *blockSet)
{
// const BRMerkleBlock *previous, *b = NULL;
// uint32_t i;
// assert(block != NULL);
// assert(blockSet != NULL);
// // check if we hit a difficulty transition, and find previous transition block
// if ((block->height % BLOCK_DIFFICULTY_INTERVAL) == 0) {
// for (i = 0, b = block; b && i < BLOCK_DIFFICULTY_INTERVAL; i++) {
// b = BRSetGet(blockSet, &b->prevBlock);
// }
// }
// previous = BRSetGet(blockSet, &block->prevBlock);
// return BRMerkleBlockVerifyDifficulty(block, previous, (b) ? b->timestamp : 0);
return 1;
}
static int BRTestNetVerifyDifficulty(const BRMerkleBlock *block, const BRSet *blockSet)
{
return 1; // XXX skip testnet difficulty check for now
}
static const BRChainParams BRMainNetParams = {
BRMainNetDNSSeeds,
10333, // standardPort
0xa7c0d29c, // magicNumber
0, // services
BRMainNetVerifyDifficulty,
BRMainNetCheckpoints,
sizeof(BRMainNetCheckpoints) / sizeof(*BRMainNetCheckpoints)};
static const BRChainParams BRTestNetParams = {
BRTestNetDNSSeeds,
14333, // standardPort
0x81d7e2b7, // magicNumber - TODO Check against testnet
0, // services
BRTestNetVerifyDifficulty,
BRTestNetCheckpoints,
sizeof(BRTestNetCheckpoints) / sizeof(*BRTestNetCheckpoints)};
#endif // BRChainParams_h