Skip to content

Commit 40efe74

Browse files
authored
Merge pull request jl777#247 from miketout/dev
Support for identities and ARM64 builds
2 parents f12556d + 16f7d73 commit 40efe74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+7533
-858
lines changed

Diff for: configure.ac

+11
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,16 @@ AC_ARG_WITH([daemon],
242242
[build_bitcoind=$withval],
243243
[build_bitcoind=yes])
244244

245+
GCC_TARGET=`$CC -dumpmachine 2>&1`
246+
case $GCC_TARGET in
247+
arm*-*-*)
248+
have_arm=true
249+
;;
250+
aarch64*-*-*)
251+
have_arm=true
252+
;;
253+
esac
254+
245255
use_pkgconfig=yes
246256
case $host in
247257
*mingw*)
@@ -879,6 +889,7 @@ AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
879889
AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes])
880890
AM_CONDITIONAL([ENABLE_MINING],[test x$enable_mining = xyes])
881891
AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes])
892+
AM_CONDITIONAL([ARCH_ARM], [test x$have_arm = xtrue])
882893
AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes])
883894
AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes])
884895
AM_CONDITIONAL([HARDEN],[test x$use_hardening = xyes])

Diff for: depends/packages/libcurl.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ $(package)_version=7.66.0
33
$(package)_download_path=https://curl.haxx.se/download
44
$(package)_file_name=curl-$($(package)_version).tar.gz
55
$(package)_sha256_hash=d0393da38ac74ffac67313072d7fe75b1fa1010eb5987f63f349b024a36b7ffb
6-
$(package)_config_opts_linux=--disable-shared --enable-static --prefix=$(host_prefix)
6+
$(package)_config_opts_linux=--disable-shared --enable-static --prefix=$(host_prefix) --host=$(HOST)
77
$(package)_config_opts_mingw32=--enable-mingw --disable-shared --enable-static --prefix=$(host_prefix) --host=x86_64-w64-mingw32
88
$(package)_config_opts_darwin=--disable-shared --enable-static --prefix=$(host_prefix)
99
$(package)_cflags_darwin=-mmacosx-version-min=10.9

Diff for: src/Makefile.am

+14-2
Original file line numberDiff line numberDiff line change
@@ -466,17 +466,29 @@ crypto_libbitcoin_crypto_a_SOURCES += \
466466
endif
467467

468468
# Verus hash specific library - optimized
469-
crypto_libverus_crypto_a_CPPFLAGS = -O3 -Wint-conversion -march=x86-64 -mpclmul -msse4 -msse4.1 -msse4.2 -mssse3 -mavx -maes -g -funroll-loops -fomit-frame-pointer -fPIC $(AM_CPPFLAGS)
470-
crypto_libverus_crypto_a_CXXFLAGS = -O3 -Wint-conversion -march=x86-64 -mpclmul -msse4 -msse4.1 -msse4.2 -mssse3 -mavx -maes -g -funroll-loops -fomit-frame-pointer -fPIC $(AM_CXXFLAGS)
469+
if ARCH_ARM
470+
crypto_libverus_crypto_a_CPPFLAGS = -O3 -Wint-conversion -g -march=armv8.1-a+crypto -flax-vector-conversions -funroll-loops -fomit-frame-pointer -fPIC $(AM_CPPFLAGS)
471+
crypto_libverus_crypto_a_CXXFLAGS = -O3 -Wint-conversion -g -march=armv8.1-a+crypto -flax-vector-conversions -funroll-loops -fomit-frame-pointer -fPIC $(AM_CXXFLAGS)
472+
else
473+
crypto_libverus_crypto_a_CPPFLAGS = -O3 -Wint-conversion -mpclmul -msse4 -msse4.1 -msse4.2 -mssse3 -mavx -maes -g -funroll-loops -fomit-frame-pointer -fPIC $(AM_CPPFLAGS)
474+
crypto_libverus_crypto_a_CXXFLAGS = -O3 -Wint-conversion -mpclmul -msse4 -msse4.1 -msse4.2 -mssse3 -mavx -maes -g -funroll-loops -fomit-frame-pointer -fPIC $(AM_CXXFLAGS)
475+
endif
476+
471477
crypto_libverus_crypto_a_SOURCES = \
472478
crypto/haraka.h \
473479
crypto/haraka.c \
474480
crypto/verus_clhash.h \
475481
crypto/verus_clhash.cpp
476482

477483
# Verus hash specific library - portable
484+
if ARCH_ARM
485+
crypto_libverus_portable_crypto_a_CPPFLAGS = -O3 -Wint-conversion -g -march=armv8.1-a+crypto -flax-vector-conversions -funroll-loops -fomit-frame-pointer -fPIC $(AM_CPPFLAGS)
486+
crypto_libverus_portable_crypto_a_CXXFLAGS = -O3 -Wint-conversion -g -march=armv8.1-a+crypto -flax-vector-conversions -funroll-loops -fomit-frame-pointer -fPIC $(AM_CXXFLAGS)
487+
else
478488
crypto_libverus_portable_crypto_a_CPPFLAGS = -O3 -Wint-conversion -march=x86-64 -g -funroll-loops -fomit-frame-pointer -fPIC $(AM_CPPFLAGS)
479489
crypto_libverus_portable_crypto_a_CXXFLAGS = -O3 -Wint-conversion -march=x86-64 -g -funroll-loops -fomit-frame-pointer -fPIC $(AM_CXXFLAGS)
490+
endif
491+
480492
crypto_libverus_portable_crypto_a_SOURCES = \
481493
crypto/haraka_portable.h \
482494
crypto/haraka_portable.c \

Diff for: src/base58.cpp

+43-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <hash.h>
88
#include <uint256.h>
99

10+
#include "pbaas/identity.h"
11+
1012
#include <assert.h>
1113
#include <string.h>
1214
#include <stdint.h>
@@ -215,6 +217,7 @@ class CBitcoinAddressVisitor : public boost::static_visitor<bool>
215217
bool operator()(const CKeyID& id) const { return addr->Set(id); }
216218
bool operator()(const CPubKey& key) const { return addr->Set(key); }
217219
bool operator()(const CScriptID& id) const { return addr->Set(id); }
220+
bool operator()(const CIdentityID& id) const { return addr->Set(id); }
218221
bool operator()(const CNoDestination& no) const { return false; }
219222
};
220223

@@ -239,6 +242,12 @@ bool CBitcoinAddress::Set(const CScriptID& id)
239242
return true;
240243
}
241244

245+
bool CBitcoinAddress::Set(const CIdentityID& id)
246+
{
247+
SetData(Params().Base58Prefix(CChainParams::IDENTITY_ADDRESS), &id, 20);
248+
return true;
249+
}
250+
242251
bool CBitcoinAddress::Set(const CTxDestination& dest)
243252
{
244253
return boost::apply_visitor(CBitcoinAddressVisitor(this), dest);
@@ -253,13 +262,22 @@ bool CBitcoinAddress::IsValid(const CChainParams& params) const
253262
{
254263
bool fCorrectSize = vchData.size() == 20;
255264
bool fKnownVersion = vchVersion == params.Base58Prefix(CChainParams::PUBKEY_ADDRESS) ||
256-
vchVersion == params.Base58Prefix(CChainParams::SCRIPT_ADDRESS);
265+
vchVersion == params.Base58Prefix(CChainParams::SCRIPT_ADDRESS) ||
266+
vchVersion == params.Base58Prefix(CChainParams::IDENTITY_ADDRESS);
257267
return fCorrectSize && fKnownVersion;
258268
}
259269

260270
bool CBitcoinAddress::SetString(const char* pszAddress)
261271
{
262-
return CBase58Data::SetString(pszAddress, 1);//2);
272+
273+
if (std::count(pszAddress, pszAddress + strlen(pszAddress), '@') == 1)
274+
{
275+
return Set(CIdentityID(CIdentity::GetID(std::string(pszAddress), uint160())));
276+
}
277+
else
278+
{
279+
return CBase58Data::SetString(pszAddress, 1);//2);
280+
}
263281
}
264282

265283
bool CBitcoinAddress::SetString(const std::string& strAddress)
@@ -277,6 +295,8 @@ CTxDestination CBitcoinAddress::Get() const
277295
return CKeyID(id);
278296
else if (vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS))
279297
return CScriptID(id);
298+
else if (vchVersion == Params().Base58Prefix(CChainParams::IDENTITY_ADDRESS))
299+
return CIdentityID(id);
280300
else
281301
return CNoDestination();
282302
}
@@ -287,11 +307,15 @@ bool CBitcoinAddress::GetIndexKey(uint160& hashBytes, int& type) const
287307
return false;
288308
} else if (vchVersion == Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS)) {
289309
memcpy(&hashBytes, &vchData[0], 20);
290-
type = 1;
310+
type = CScript::P2PKH;
311+
return true;
312+
} else if (vchVersion == Params().Base58Prefix(CChainParams::IDENTITY_ADDRESS)) {
313+
memcpy(&hashBytes, &vchData[0], 20);
314+
type = CScript::P2ID;
291315
return true;
292316
} else if (vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS)) {
293317
memcpy(&hashBytes, &vchData[0], 20);
294-
type = 2;
318+
type = CScript::P2SH;
295319
return true;
296320
}
297321

@@ -316,11 +340,26 @@ bool CBitcoinAddress::GetKeyID_NoCheck(CKeyID& keyID) const
316340
return true;
317341
}
318342

343+
bool CBitcoinAddress::GetIdentityID(CIdentityID& idID) const
344+
{
345+
if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::IDENTITY_ADDRESS))
346+
return false;
347+
uint160 id;
348+
memcpy(&id, &vchData[0], 20);
349+
idID = CIdentityID(id);
350+
return true;
351+
}
352+
319353
bool CBitcoinAddress::IsScript() const
320354
{
321355
return IsValid() && vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS);
322356
}
323357

358+
bool CBitcoinAddress::IsIdentity() const
359+
{
360+
return IsValid() && vchVersion == Params().Base58Prefix(CChainParams::IDENTITY_ADDRESS);
361+
}
362+
324363
void CBitcoinSecret::SetKey(const CKey& vchSecret)
325364
{
326365
assert(vchSecret.IsValid());

Diff for: src/base58.h

+3
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class CBitcoinAddress : public CBase58Data {
118118
bool Set(const CKeyID &id);
119119
bool Set(const CPubKey &key);
120120
bool Set(const CScriptID &id);
121+
bool Set(const CIdentityID& id);
121122
bool Set(const CTxDestination &dest);
122123
bool IsValid() const;
123124
bool IsValid(const CChainParams &params) const;
@@ -131,9 +132,11 @@ class CBitcoinAddress : public CBase58Data {
131132

132133
CTxDestination Get() const;
133134
bool GetKeyID(CKeyID &keyID) const;
135+
bool GetIdentityID(CIdentityID &idID) const;
134136
bool GetKeyID_NoCheck(CKeyID& keyID) const;
135137
bool GetIndexKey(uint160& hashBytes, int& type) const;
136138
bool IsScript() const;
139+
bool IsIdentity() const;
137140
};
138141

139142
/**

Diff for: src/cc/CCGateways.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "CCinclude.h"
2121
#include "../merkleblock.h"
2222

23-
bool GatewaysValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
23+
bool GatewaysValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn, bool fulfilled);
2424
std::string GatewaysBind(uint64_t txfee,std::string coin,uint256 tokenid,int64_t totalsupply,uint256 oracletxid,uint8_t M,uint8_t N,std::vector<CPubKey> pubkeys);
2525
std::string GatewaysDeposit(uint64_t txfee,uint256 bindtxid,int32_t height,std::string refcoin,uint256 cointxid,int32_t claimvout,std::string deposithex,std::vector<uint8_t>proof,CPubKey destpub,int64_t amount);
2626
std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,uint256 deposittxid,CPubKey destpub,int64_t amount);

Diff for: src/cc/CCMofN.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#define EVAL_MOFN 0xea
2323

24-
bool MofNValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
24+
bool MofNValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn, bool fulfilled);
2525

2626
// CCcustom
2727
UniValue MofNInfo();

Diff for: src/cc/CCOracles.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "CCinclude.h"
2121

22-
bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
22+
bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn, bool fulfilled);
2323
std::string OracleCreate(int64_t txfee,std::string name,std::string description,std::string format);
2424
std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee);
2525
std::string OracleSubscribe(int64_t txfee,uint256 oracletxid,CPubKey publisher,int64_t amount);

Diff for: src/cc/CCPayments.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "CCinclude.h"
2121

22-
bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
22+
bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn, bool fulfilled);
2323

2424
// CCcustom
2525
UniValue PaymentsInfo();

Diff for: src/cc/CCPegs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "CCinclude.h"
2121

22-
bool PegsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
22+
bool PegsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn, bool fulfilled);
2323

2424
// CCcustom
2525
UniValue PegsInfo();

Diff for: src/cc/CCPrices.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "CCinclude.h"
2121

22-
bool PricesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
22+
bool PricesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn, bool fulfilled);
2323

2424
// CCcustom
2525
UniValue PricesInfo();

Diff for: src/cc/CCTriggers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "CCinclude.h"
2121

22-
bool TriggersValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
22+
bool TriggersValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn, bool fulfilled);
2323

2424
// CCcustom
2525
UniValue TriggersInfo();

Diff for: src/cc/CCassets.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "CCinclude.h"
2727

2828
// CCcustom
29-
bool AssetsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
29+
bool AssetsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn, bool fulfilled);
3030

3131
// CCassetsCore
3232
//CTxOut MakeAssetsVout(CAmount nValue,CPubKey pk);

Diff for: src/cc/CCauction.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#define EVAL_AUCTION 0xe8
2323

24-
bool AuctionValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
24+
bool AuctionValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn, bool fulfilled);
2525

2626
std::string AuctionPost(uint64_t txfee,uint256 itemhash,int64_t minbid,char *title,char *description);
2727
std::string AuctionBid(uint64_t txfee,uint256 itemhash,int64_t amount);

Diff for: src/cc/CCchannels.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "CCinclude.h"
2121
#define CHANNELS_MAXPAYMENTS 1000
2222

23-
bool ChannelsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
23+
bool ChannelsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn, bool fulfilled);
2424
std::string ChannelOpen(uint64_t txfee,CPubKey destpub,int32_t numpayments,int64_t payment);
2525
std::string ChannelStop(uint64_t txfee,CPubKey destpub,uint256 origtxid);
2626
std::string ChannelPayment(uint64_t txfee,uint256 prevtxid,uint256 origtxid,int32_t n,int64_t amount);

0 commit comments

Comments
 (0)