From e5f98eb8e65afe961eccef34769033fd85a25349 Mon Sep 17 00:00:00 2001 From: Igor Guerrero Date: Wed, 11 Jul 2018 17:42:46 -0400 Subject: [PATCH 1/2] Add chainparams back --- BRChainParams.h | 7 +++++-- BRPeerManager.c | 6 +++--- BRPeerManager.h | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/BRChainParams.h b/BRChainParams.h index c19932f07..7cc2b59c0 100644 --- a/BRChainParams.h +++ b/BRChainParams.h @@ -84,7 +84,8 @@ static const BRCheckPoint BRMainNetCheckpoints[] = { { 443520, uint256("00000000000000000345d0c7890b2c81ab5139c6e83400e5bed00d23a1f8d239"), 1481765313, 0x18038b85 }, { 463680, uint256("000000000000000000431a2f4619afe62357cd16589b638bb638f2992058d88e"), 1493259601, 0x18021b3e }, { 483840, uint256("0000000000000000008e5d72027ef42ca050a0776b7184c96d0d4b300fa5da9e"), 1504704195, 0x1801310b }, - { 504000, uint256("0000000000000000006cd44d7a940c79f94c7c272d159ba19feb15891aa1ea54"), 1515827554, 0x177e578c } + { 504000, uint256("0000000000000000006cd44d7a940c79f94c7c272d159ba19feb15891aa1ea54"), 1515827554, 0x177e578c }, + { 524160, uint256("00000000000000000009d1e9bee76d334347060c6a2985d6cbc5c22e48f14ed2"), 1527166793, 0x17415a49 } }; static const BRCheckPoint BRTestNetCheckpoints[] = { @@ -99,7 +100,9 @@ static const BRCheckPoint BRTestNetCheckpoints[] = { { 806400, uint256("0000000000000faf114ff29df6dbac969c6b4a3b407cd790d3a12742b50c2398"), 1462006183, 0x1a34e280 }, { 907200, uint256("0000000000166938e6f172a21fe69fe335e33565539e74bf74eeb00d2022c226"), 1469705562, 0x1c00ffff }, { 1008000, uint256("000000000000390aca616746a9456a0d64c1bd73661fd60a51b5bf1c92bae5a0"), 1476926743, 0x1a52ccc0 }, - { 1108800, uint256("00000000000288d9a219419d0607fb67cc324d4b6d2945ca81eaa5e739fab81e"), 1490751239, 0x1b09ecf0 } + { 1108800, uint256("00000000000288d9a219419d0607fb67cc324d4b6d2945ca81eaa5e739fab81e"), 1490751239, 0x1b09ecf0 }, + { 1209600, uint256("0000000000000026b4692a26f1651bec8e9d4905640bd8e56056c9a9c53badf8"), 1507352962, 0x1973e180 }, + { 1310400, uint256("0000000000013b434bbe5668293c92ef26df6d6d4843228e8958f6a3d8101709"), 1527063767, 0x1b0ffff0 } }; static int BRMainNetVerifyDifficulty(const BRMerkleBlock *block, const BRSet *blockSet) diff --git a/BRPeerManager.c b/BRPeerManager.c index 09c30b839..4d029ebb2 100644 --- a/BRPeerManager.c +++ b/BRPeerManager.c @@ -1452,15 +1452,15 @@ static void _dummyThreadCleanup(void *info) } // returns a newly allocated BRPeerManager struct that must be freed by calling BRPeerManagerFree() -BRPeerManager *BRPeerManagerNew(/*const BRChainParams *params, */BRWallet *wallet, uint32_t earliestKeyTime, +BRPeerManager *BRPeerManagerNew(const BRChainParams *params, BRWallet *wallet, uint32_t earliestKeyTime, BRMerkleBlock *blocks[], size_t blocksCount, const BRPeer peers[], size_t peersCount) { BRPeerManager *manager = calloc(1, sizeof(*manager)); BRMerkleBlock orphan, *block = NULL; assert(manager != NULL); - // assert(params != NULL); - // assert(params->standardPort != 0); + assert(params != NULL); + assert(params->standardPort != 0); assert(wallet != NULL); assert(blocks != NULL || blocksCount == 0); assert(peers != NULL || peersCount == 0); diff --git a/BRPeerManager.h b/BRPeerManager.h index 823b4ea61..2bb0d4c21 100644 --- a/BRPeerManager.h +++ b/BRPeerManager.h @@ -42,7 +42,7 @@ extern "C" { typedef struct BRPeerManagerStruct BRPeerManager; // returns a newly allocated BRPeerManager struct that must be freed by calling BRPeerManagerFree() -BRPeerManager *BRPeerManagerNew(/*const BRChainParams *params, */BRWallet *wallet, uint32_t earliestKeyTime, +BRPeerManager *BRPeerManagerNew(const BRChainParams *params, BRWallet *wallet, uint32_t earliestKeyTime, BRMerkleBlock *blocks[], size_t blocksCount, const BRPeer peers[], size_t peersCount); // not thread-safe, set callbacks once before calling BRPeerManagerConnect() From 8f8f1de686313f931ffc998d0be3ae3cf217d670 Mon Sep 17 00:00:00 2001 From: Igor Guerrero Date: Thu, 12 Jul 2018 12:50:10 -0400 Subject: [PATCH 2/2] Remove unneeded params. --- BRPeerManager.c | 9 ++++----- BRPeerManager.h | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/BRPeerManager.c b/BRPeerManager.c index 4d029ebb2..1df2120ee 100644 --- a/BRPeerManager.c +++ b/BRPeerManager.c @@ -1452,21 +1452,20 @@ static void _dummyThreadCleanup(void *info) } // returns a newly allocated BRPeerManager struct that must be freed by calling BRPeerManagerFree() -BRPeerManager *BRPeerManagerNew(const BRChainParams *params, BRWallet *wallet, uint32_t earliestKeyTime, - BRMerkleBlock *blocks[], size_t blocksCount, const BRPeer peers[], size_t peersCount) +BRPeerManager *BRPeerManagerNew(BRWallet *wallet, uint32_t earliestKeyTime, BRMerkleBlock *blocks[], + size_t blocksCount, const BRPeer peers[], size_t peersCount) { BRPeerManager *manager = calloc(1, sizeof(*manager)); BRMerkleBlock orphan, *block = NULL; assert(manager != NULL); - assert(params != NULL); - assert(params->standardPort != 0); assert(wallet != NULL); assert(blocks != NULL || blocksCount == 0); assert(peers != NULL || peersCount == 0); - manager->params = &BRMainNetParams; #if BITCOIN_TESTNET manager->params = &BRTestNetParams; +#else + manager->params = &BRMainNetParams; #endif manager->wallet = wallet; manager->earliestKeyTime = earliestKeyTime; diff --git a/BRPeerManager.h b/BRPeerManager.h index 2bb0d4c21..586275754 100644 --- a/BRPeerManager.h +++ b/BRPeerManager.h @@ -42,8 +42,9 @@ extern "C" { typedef struct BRPeerManagerStruct BRPeerManager; // returns a newly allocated BRPeerManager struct that must be freed by calling BRPeerManagerFree() -BRPeerManager *BRPeerManagerNew(const BRChainParams *params, BRWallet *wallet, uint32_t earliestKeyTime, - BRMerkleBlock *blocks[], size_t blocksCount, const BRPeer peers[], size_t peersCount); +BRPeerManager *BRPeerManagerNew(BRWallet *wallet, uint32_t earliestKeyTime, + BRMerkleBlock *blocks[], size_t blocksCount, + const BRPeer peers[], size_t peersCount); // not thread-safe, set callbacks once before calling BRPeerManagerConnect() // info is a void pointer that will be passed along with each callback call