From 4d2d088a63444569d9a99670214a16210ddf5f58 Mon Sep 17 00:00:00 2001 From: Kerry Washington Date: Wed, 29 Mar 2023 07:10:50 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80[Release=20v1.0.0]=20Merge=20into?= =?UTF-8?q?=20Main=20=20(#30)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * typo :) * va_list include * enable ipv6 * default to ipv6 and fallback to ipv4 * fix ipv4 fallback * Increase MAX_FEE_PER_KB * Fix 0 change output * sha3-256 and keccak-256 * const keywords * update tx ordering on confirmation * compiler warnings * Litecoin: params * Litecoin: scrypt pow & max_proof_of_work * Litecoin: disable retarget check * Litecoin: add new checkpoint * BIP39_CREATION_TIME -> LoafWallet release date * update secp * make sure to call balanceChanged callback whenever balance is updated * Change bitcoin-testnet with litecoin-testnet * bech32: update files * add missing files * add BRPeerManagerStandardPort method which returns the standard port used for chain params * 🦺Updated the checkpoints: Android branch (#24) * Updated the checkpoints * only 1 checkpoint added * Added Testnet checkpoint * added interface to set fpRate (#28) fpRate: false positive rate for the bloomfilter * fixed the signature (#29) --------- Co-authored-by: LiteBit Co-authored-by: Aaron Voisine Co-authored-by: Adrian Corscadden Co-authored-by: Luca Vaccaro Co-authored-by: Loshan T Co-authored-by: Mohamed Barry --- BRAddress.c | 23 ++++++++---------- BRAddress.h | 2 +- BRBech32.c | 1 - BRBech32.h | 1 - BRKey.c | 8 +++---- BRMerkleBlock.c | 3 +-- BRPeer.h | 2 +- BRPeerManager.c | 15 ++++++------ BRPeerManager.h | 3 ++- BRTransaction.c | 2 -- secp256k1 | 2 +- test.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++--- 12 files changed, 87 insertions(+), 37 deletions(-) diff --git a/BRAddress.c b/BRAddress.c index 2c1478559..fbdf91de2 100644 --- a/BRAddress.c +++ b/BRAddress.c @@ -245,12 +245,11 @@ size_t BRAddressFromScriptPubKey(char *addr, size_t addrLen, const uint8_t *scri const uint8_t *d, *elems[BRScriptElements(NULL, 0, script, scriptLen)]; char a[91]; size_t r = 0, l = 0, count = BRScriptElements(elems, sizeof(elems)/sizeof(*elems), script, scriptLen); - if (count == 5 && *elems[0] == OP_DUP && *elems[1] == OP_HASH160 && *elems[2] == 20 && *elems[3] == OP_EQUALVERIFY && *elems[4] == OP_CHECKSIG) { // pay-to-pubkey-hash scriptPubKey data[0] = BITCOIN_PUBKEY_ADDRESS; -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET data[0] = BITCOIN_PUBKEY_ADDRESS_TEST; #endif memcpy(&data[1], BRScriptData(elems[2], &l), 20); @@ -259,7 +258,7 @@ size_t BRAddressFromScriptPubKey(char *addr, size_t addrLen, const uint8_t *scri else if (count == 3 && *elems[0] == OP_HASH160 && *elems[1] == 20 && *elems[2] == OP_EQUAL) { // pay-to-script-hash scriptPubKey data[0] = BITCOIN_SCRIPT_ADDRESS; -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET data[0] = BITCOIN_SCRIPT_ADDRESS_TEST; #endif memcpy(&data[1], BRScriptData(elems[1], &l), 20); @@ -268,7 +267,7 @@ size_t BRAddressFromScriptPubKey(char *addr, size_t addrLen, const uint8_t *scri else if (count == 2 && (*elems[0] == 65 || *elems[0] == 33) && *elems[1] == OP_CHECKSIG) { // pay-to-pubkey scriptPubKey data[0] = BITCOIN_PUBKEY_ADDRESS; -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET data[0] = BITCOIN_PUBKEY_ADDRESS_TEST; #endif d = BRScriptData(elems[0], &l); @@ -279,7 +278,7 @@ size_t BRAddressFromScriptPubKey(char *addr, size_t addrLen, const uint8_t *scri (*elems[0] >= OP_1 && *elems[0] <= OP_16 && *elems[1] >= 2 && *elems[1] <= 40))) { // pay-to-witness scriptPubKey r = BRBech32Encode(a, "ltc", script); -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET r = BRBech32Encode(a, "tltc", script); #endif if (addr && r > addrLen) r = 0; @@ -301,7 +300,7 @@ size_t BRAddressFromScriptSig(char *addr, size_t addrLen, const uint8_t *script, size_t count = BRScriptElements(elems, sizeof(elems)/sizeof(*elems), script, scriptLen), l = 0; data[0] = BITCOIN_PUBKEY_ADDRESS; -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET data[0] = BITCOIN_PUBKEY_ADDRESS_TEST; #endif @@ -314,7 +313,7 @@ size_t BRAddressFromScriptSig(char *addr, size_t addrLen, const uint8_t *script, else if (count >= 2 && *elems[count - 2] <= OP_PUSHDATA4 && *elems[count - 1] <= OP_PUSHDATA4 && *elems[count - 1] > 0) { // pay-to-script-hash scriptSig data[0] = BITCOIN_SCRIPT_ADDRESS; -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET data[0] = BITCOIN_SCRIPT_ADDRESS_TEST; #endif d = BRScriptData(elems[count - 1], &l); @@ -324,7 +323,6 @@ size_t BRAddressFromScriptSig(char *addr, size_t addrLen, const uint8_t *script, // TODO: implement Peter Wullie's pubKey recovery from signature } // pay-to-witness scriptSig's are empty - return (d) ? BRBase58CheckEncode(addr, addrLen, data, 21) : 0; } @@ -345,7 +343,7 @@ size_t BRAddressScriptPubKey(uint8_t *script, size_t scriptLen, const char *addr assert(addr != NULL); -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET pubkeyAddress = BITCOIN_PUBKEY_ADDRESS_TEST; scriptAddress = BITCOIN_SCRIPT_ADDRESS_TEST; bech32Prefix = "tltc"; @@ -377,7 +375,6 @@ size_t BRAddressScriptPubKey(uint8_t *script, size_t scriptLen, const char *addr } else { dataLen = BRBech32Decode(hrp, data, addr); - if (dataLen > 2 && strcmp(hrp, bech32Prefix) == 0 && (data[0] != OP_0 || data[1] == 20 || data[1] == 32)) { if (script && dataLen <= scriptLen) memcpy(script, data, dataLen); r = (! script || dataLen <= scriptLen) ? dataLen : 0; @@ -399,18 +396,18 @@ int BRAddressIsValid(const char *addr) if (BRBase58CheckDecode(data, sizeof(data), addr) == 21) { r = (data[0] == BITCOIN_PUBKEY_ADDRESS || data[0] == BITCOIN_SCRIPT_ADDRESS); -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET r = (data[0] == BITCOIN_PUBKEY_ADDRESS_TEST || data[0] == BITCOIN_SCRIPT_ADDRESS_TEST); #endif } else if (BRBech32Decode(hrp, data, addr) > 2) { r = (strcmp(hrp, "ltc") == 0 && (data[0] != OP_0 || data[1] == 20 || data[1] == 32)); -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET r = (strcmp(hrp, "tltc") == 0 && (data[0] != OP_0 || data[1] == 20 || data[1] == 32)); #endif } - + return r; } diff --git a/BRAddress.h b/BRAddress.h index cf426d19d..14b1aa5b9 100644 --- a/BRAddress.h +++ b/BRAddress.h @@ -34,7 +34,7 @@ extern "C" { #endif -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET #pragma message "testnet build" #endif diff --git a/BRBech32.c b/BRBech32.c index 8dfd6d076..7773895c5 100644 --- a/BRBech32.c +++ b/BRBech32.c @@ -1,6 +1,5 @@ // // BRBech32.c -// breadwallet-core // // Created by Aaron Voisine on 1/20/18. // Copyright (c) 2018 breadwallet LLC diff --git a/BRBech32.h b/BRBech32.h index 69f703316..e9b9ca445 100644 --- a/BRBech32.h +++ b/BRBech32.h @@ -1,6 +1,5 @@ // // BRBech32.h -// breadwallet-core // // Created by Aaron Voisine on 1/20/18. // Copyright (c) 2018 breadwallet LLC diff --git a/BRKey.c b/BRKey.c index 0b92dccc3..ca6eb06a4 100644 --- a/BRKey.c +++ b/BRKey.c @@ -130,7 +130,7 @@ int BRPrivKeyIsValid(const char *privKey) strLen = strlen(privKey); if (dataLen == 33 || dataLen == 34) { // wallet import format: https://en.bitcoin.it/wiki/Wallet_import_format -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET r = (data[0] == BITCOIN_PRIVKEY_TEST); #else r = (data[0] == BITCOIN_PRIVKEY); @@ -172,7 +172,7 @@ int BRKeySetPrivKey(BRKey *key, const char *privKey) uint8_t data[34], version = BITCOIN_PRIVKEY; int r = 0; -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET version = BITCOIN_PRIVKEY_TEST; #endif @@ -233,7 +233,7 @@ size_t BRKeyPrivKey(const BRKey *key, char *privKey, size_t pkLen) if (secp256k1_ec_seckey_verify(_ctx, key->secret.u8)) { data[0] = BITCOIN_PRIVKEY; -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET data[0] = BITCOIN_PRIVKEY_TEST; #endif @@ -292,7 +292,7 @@ size_t BRKeyAddress(BRKey *key, char *addr, size_t addrLen) hash = BRKeyHash160(key); data[0] = BITCOIN_PUBKEY_ADDRESS; -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET data[0] = BITCOIN_PUBKEY_ADDRESS_TEST; #endif UInt160Set(&data[1], hash); diff --git a/BRMerkleBlock.c b/BRMerkleBlock.c index b6c6d2b60..280a2e736 100644 --- a/BRMerkleBlock.c +++ b/BRMerkleBlock.c @@ -334,14 +334,13 @@ int BRMerkleBlockVerifyDifficulty(const BRMerkleBlock *block, const BRMerkleBloc if (! previous || !UInt256Eq(block->prevBlock, previous->blockHash) || block->height != previous->height + 1) r = 0; if (r && (block->height % BLOCK_DIFFICULTY_INTERVAL) == 0 && transitionTime == 0) r = 0; - // if (r && (block->height % BLOCK_DIFFICULTY_INTERVAL) == 0) { // // target is in "compact" format, where the most significant byte is the size of resulting value in bytes, next // // bit is the sign, and the remaining 23bits is the value after having been right shifted by (size - 3)*8 bits // static const uint32_t maxsize = MAX_PROOF_OF_WORK >> 24, maxtarget = MAX_PROOF_OF_WORK & 0x00ffffff; // int timespan = (int)((int64_t)previous->timestamp - (int64_t)transitionTime), size = previous->target >> 24; // uint64_t target = previous->target & 0x00ffffff; - + // // limit difficulty transition to -75% or +400% // if (timespan < TARGET_TIMESPAN/4) timespan = TARGET_TIMESPAN/4; // if (timespan > TARGET_TIMESPAN*4) timespan = TARGET_TIMESPAN*4; diff --git a/BRPeer.h b/BRPeer.h index d037ec9e2..36cd5983a 100644 --- a/BRPeer.h +++ b/BRPeer.h @@ -57,7 +57,7 @@ extern "C" { #define SERVICES_NODE_BCASH 0x20 // https://github.com/Bitcoin-UAHF/spec/blob/master/uahf-technical-spec.md #define BR_VERSION "2.1" -#define USER_AGENT "/loaf:" BR_VERSION "/" +#define USER_AGENT "/litewallet-loafwallet-core:" BR_VERSION "/" // explanation of message types at: https://en.bitcoin.it/wiki/Protocol_specification #define MSG_VERSION "version" diff --git a/BRPeerManager.c b/BRPeerManager.c index 3aa21d59d..202c702d2 100644 --- a/BRPeerManager.c +++ b/BRPeerManager.c @@ -274,9 +274,8 @@ static void _BRPeerManagerLoadBloomFilter(BRPeerManager *manager, BRPeer *peer) BRSetApply(manager->orphans, NULL, _setApplyFreeBlock); BRSetClear(manager->orphans); // clear out orphans that may have been received on an old filter manager->lastOrphan = NULL; - manager->filterUpdateHeight = manager->lastBlock->height; - manager->fpRate = BLOOM_REDUCED_FALSEPOSITIVE_RATE; - + manager->filterUpdateHeight = manager->lastBlock->height; + size_t addrsCount = BRWalletAllAddrs(manager->wallet, NULL, 0); BRAddress *addrs = malloc(addrsCount*sizeof(*addrs)); size_t utxosCount = BRWalletUTXOs(manager->wallet, NULL, 0); @@ -796,7 +795,6 @@ static void _peerConnected(void *info) peer_log(peer, "selecting new download peer with higher reported lastblock"); BRPeerDisconnect(manager->downloadPeer); } - manager->downloadPeer = peer; manager->isConnected = 1; manager->estimatedHeight = BRPeerLastBlock(peer); @@ -1118,7 +1116,7 @@ static void _peerRejectedTx(void *info, UInt256 txHash, uint8_t code) static int _BRPeerManagerVerifyBlock(BRPeerManager *manager, BRMerkleBlock *block, BRMerkleBlock *prev, BRPeer *peer) { int r = 1; - + if (! prev || ! UInt256Eq(block->prevBlock, prev->blockHash) || block->height != prev->height + 1) r = 0; // check if we hit a difficulty transition, and find previous transition time @@ -1135,7 +1133,7 @@ static int _BRPeerManagerVerifyBlock(BRPeerManager *manager, BRMerkleBlock *bloc r = 0; } else prevBlock = b->prevBlock; - + while (b) { // free up some memory b = BRSetGet(manager->blocks, &prevBlock); if (b) prevBlock = b->prevBlock; @@ -1525,7 +1523,9 @@ 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) + BRMerkleBlock *blocks[], size_t blocksCount, + const BRPeer peers[], size_t peersCount, + double fpRate) { BRPeerManager *manager = calloc(1, sizeof(*manager)); BRMerkleBlock orphan, *block = NULL; @@ -1548,6 +1548,7 @@ BRPeerManager *BRPeerManagerNew(const BRChainParams *params, BRWallet *wallet, u manager->blocks = BRSetNew(BRMerkleBlockHash, BRMerkleBlockEq, blocksCount); manager->orphans = BRSetNew(_BRPrevBlockHash, _BRPrevBlockEq, blocksCount); // orphans are indexed by prevBlock manager->checkpoints = BRSetNew(_BRBlockHeightHash, _BRBlockHeightEq, 100); // checkpoints are indexed by height + manager->fpRate = fpRate; //loading the preferred rate for (size_t i = 0; i < manager->params->checkpointsCount; i++) { block = BRMerkleBlockNew(); diff --git a/BRPeerManager.h b/BRPeerManager.h index 55c097e45..ff654d6dc 100644 --- a/BRPeerManager.h +++ b/BRPeerManager.h @@ -43,7 +43,8 @@ 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); + BRMerkleBlock *blocks[], size_t blocksCount, const BRPeer peers[], size_t peersCount, + double fpRate); // not thread-safe, set callbacks once before calling BRPeerManagerConnect() // info is a void pointer that will be passed along with each callback call diff --git a/BRTransaction.c b/BRTransaction.c index 8a7b4e73a..3becdf396 100644 --- a/BRTransaction.c +++ b/BRTransaction.c @@ -341,7 +341,6 @@ BRTransaction *BRTransactionCopy(const BRTransaction *tx) BRTransaction *cpy = BRTransactionNew(); BRTxInput *inputs = cpy->inputs; BRTxOutput *outputs = cpy->outputs; - assert(tx != NULL); *cpy = *tx; cpy->inputs = inputs; @@ -353,7 +352,6 @@ BRTransaction *BRTransactionCopy(const BRTransaction *tx) tx->inputs[i].script, tx->inputs[i].scriptLen, tx->inputs[i].signature, tx->inputs[i].sigLen, tx->inputs[i].sequence); } - for (size_t i = 0; i < tx->outCount; i++) { BRTransactionAddOutput(cpy, tx->outputs[i].amount, tx->outputs[i].script, tx->outputs[i].scriptLen); } diff --git a/secp256k1 b/secp256k1 index c663397f4..b408c6a8b 160000 --- a/secp256k1 +++ b/secp256k1 @@ -1 +1 @@ -Subproject commit c663397f46152e96c548ba392858c730e132dd7a +Subproject commit b408c6a8b287003d1ade5709e6f7bc3c7f1d5be7 diff --git a/test.c b/test.c index d75160c7d..7b212edb8 100644 --- a/test.c +++ b/test.c @@ -60,7 +60,11 @@ #define _va_rest(first, ...) __VA_ARGS__ #endif +<<<<<<< HEAD +#if LITECOIN_TESTNET +======= #if BITCOIN_TESTNET +>>>>>>> origin/main #define BR_CHAIN_PARAMS BRTestNetParams #else #define BR_CHAIN_PARAMS BRMainNetParams @@ -328,12 +332,20 @@ int BRBech32Tests() char h[84]; char *s, addr[91]; size_t l; +<<<<<<< HEAD + +======= +>>>>>>> origin/main s = "\x00\x14\x75\x1e\x76\xe8\x19\x91\x96\xd4\x54\x94\x1c\x45\xd1\xb3\xa3\x23\xf1\x43\x3b\xd6"; l = BRBech32Decode(h, b, "BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4"); if (l != 22 || strcmp(h, "bc") || memcmp(s, b, l)) r = 0, fprintf(stderr, "\n***FAILED*** %s: BRBech32Decode() test 1", __func__); +<<<<<<< HEAD + +======= +>>>>>>> origin/main l = BRBech32Decode(h, b, "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"); if (l != 22 || strcmp(h, "bc") || memcmp(s, b, l)) r = 0, fprintf(stderr, "\n***FAILED*** %s: BRBech32Decode() test 2", __func__); @@ -1050,7 +1062,7 @@ int BRKeyTests() BRKeySetPrivKey(&key, "S6c56bnXQiBjk9mqSYE7ykVQ7NzrRy"); BRKeyAddress(&key, addr.s, sizeof(addr)); printf("privKey:S6c56bnXQiBjk9mqSYE7ykVQ7NzrRy = %s\n", addr.s); -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET if (! BRAddressEq(&addr, "ms8fwvXzrCoyatnGFRaLbepSqwGRxVJQF1")) r = 0, fprintf(stderr, "***FAILED*** %s: BRKeySetPrivKey() test 1\n", __func__); #else @@ -1065,7 +1077,7 @@ int BRKeyTests() BRKeySetPrivKey(&key, "SzavMBLoXU6kDrqtUVmffv"); BRKeyAddress(&key, addr.s, sizeof(addr)); printf("privKey:SzavMBLoXU6kDrqtUVmffv = %s\n", addr.s); -#if BITCOIN_TESTNET +#if LITECOIN_TESTNET if (! BRAddressEq(&addr, "mrhzp5mstA4Midx85EeCjuaUAAGANMFmRP")) r = 0, fprintf(stderr, "***FAILED*** %s: BRKeySetPrivKey() test 2\n", __func__); #else @@ -1073,7 +1085,7 @@ int BRKeyTests() r = 0, fprintf(stderr, "***FAILED*** %s: BRKeySetPrivKey() test 2\n", __func__); #endif -#if ! BITCOIN_TESTNET +#if ! LITECOIN_TESTNET // uncompressed private key if (! BRPrivKeyIsValid("5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF")) r = 0, fprintf(stderr, "***FAILED*** %s: BRPrivKeyIsValid() test 3\n", __func__); @@ -1623,14 +1635,22 @@ int BRBIP32SequenceTests() "banner amused fringe fox insect roast aunt prefer hollow basic ladder", NULL); BRBIP32BitIDKey(&key, dk.u8, sizeof(dk), 0, "http://bitid.bitcoin.blue/callback"); BRKeyAddress(&key, addr.s, sizeof(addr)); +<<<<<<< HEAD +#if LITECOIN_TESTNET +======= #if BITCOIN_TESTNET +>>>>>>> origin/main if (strncmp(addr.s, "mxZ2Dn9vcyNeKh9DNHZw6d6NrxeYCVNjc2", sizeof(addr)) != 0) r = 0, fprintf(stderr, "***FAILED*** %s: BRBIP32BitIDKey() test\n", __func__); #else if (strncmp(addr.s, "1J34vj4wowwPYafbeibZGht3zy3qERoUM1", sizeof(addr)) != 0) r = 0, fprintf(stderr, "***FAILED*** %s: BRBIP32BitIDKey() test\n", __func__); #endif +<<<<<<< HEAD + +======= +>>>>>>> origin/main // TODO: XXX test BRBIP32SerializeMasterPrivKey() // TODO: XXX test BRBIP32SerializeMasterPubKey() @@ -1805,6 +1825,34 @@ int BRTransactionTests() BRTransactionFree(tgt); BRTransactionFree(src); +<<<<<<< HEAD + BRTransaction *src = BRTransactionNew (); + BRTransactionAddInput(src, inHash, 0, 1, script, scriptLen, NULL, 0, TXIN_SEQUENCE); + BRTransactionAddInput(src, inHash, 0, 1, script, scriptLen, NULL, 0, TXIN_SEQUENCE); + BRTransactionAddOutput(src, 1000000, script, scriptLen); + BRTransactionAddOutput(src, 1000000, script, scriptLen); + BRTransactionAddOutput(src, 1000000, script, scriptLen); + + BRTransaction *tgt = BRTransactionCopy(src); + if (!BRTransactionEqual(tgt, src)) + r = 0, fprintf(stderr, "\n***FAILED*** %s: BRTransactionCopy() test 1", __func__); + + tgt->blockHeight++; + if (BRTransactionEqual(tgt, src)) // fail if equal + r = 0, fprintf(stderr, "\n***FAILED*** %s: BRTransactionCopy() test 2", __func__); + + BRTransactionFree(tgt); + BRTransactionFree(src); + + src = BRTransactionParse(buf4, len4); + tgt = BRTransactionCopy(src); + if (!BRTransactionEqual(tgt, src)) + r = 0, fprintf(stderr, "\n***FAILED*** %s: BRTransactionCopy() test 3", __func__); + BRTransactionFree(tgt); + BRTransactionFree(src); + +======= +>>>>>>> origin/main if (! r) fprintf(stderr, "\n "); return r; } @@ -2150,7 +2198,11 @@ int BRMerkleBlockTests() // TODO: XXX test BRMerkleBlockVerifyDifficulty() // TODO: test (CVE-2012-2459) vulnerability +<<<<<<< HEAD + +======= +>>>>>>> origin/main BRMerkleBlock *c = BRMerkleBlockCopy(b); if (!BRMerkleBlockEqual(b, c)) @@ -2532,7 +2584,11 @@ int BRPaymentProtocolEncryptionTests() BRKeySetSecret(&senderKey, &uint256("0000000000000000000000000000000000000000000000000000000000000001"), 1); BRKeySetSecret(&receiverKey, &uint256("0000000000000000000000000000000000000000000000000000000000000002"), 1); +<<<<<<< HEAD + +======= +>>>>>>> origin/main BRPaymentProtocolInvoiceRequest *req = BRPaymentProtocolInvoiceRequestNew(&senderKey, 0, NULL, NULL, 0, NULL, NULL, NULL, 0);