-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from galpHub/origin_master0_update
Improvements for tests, SECP and startup
- Loading branch information
Showing
53 changed files
with
1,016 additions
and
850 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM ubuntu:bionic | ||
|
||
RUN apt-get update | ||
RUN apt-get install apt-utils -y | ||
RUN apt-get install bsdmainutils -y | ||
RUN apt-get install software-properties-common -y | ||
RUN add-apt-repository ppa:bitcoin/bitcoin -y | ||
RUN apt-get update | ||
|
||
RUN apt-get install make -y | ||
RUN apt-get install gcc -y | ||
RUN apt-get install g++ -y | ||
RUN apt-get install pkg-config -y | ||
RUN apt-get install autoconf -y | ||
RUN apt-get install libtool -y | ||
RUN apt-get install libboost-all-dev -y | ||
RUN apt-get install libssl1.0-dev -y | ||
RUN apt-get install libevent-dev -y | ||
RUN apt-get install libdb4.8-dev libdb4.8++-dev -y | ||
|
||
WORKDIR /app | ||
COPY . . | ||
|
||
RUN ./autogen.sh | ||
RUN ./configure --without-gui NO_QT=1 | ||
RUN make NO_QT=1 | ||
RUN make check | ||
|
||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "Secp256k1Context.h" | ||
|
||
#include <assert.h> | ||
#include "random.h" | ||
#include "allocators.h" | ||
|
||
Secp256k1Context::Secp256k1Context() | ||
{ | ||
assert(verifying_context == NULL); | ||
verifying_context = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY); | ||
assert(verifying_context != NULL); | ||
|
||
|
||
assert(signing_context == NULL); | ||
secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); | ||
assert(ctx != NULL); | ||
{ | ||
// Pass in a random blinding seed to the secp256k1 context. | ||
std::vector<unsigned char, secure_allocator<unsigned char>> vseed(32); | ||
GetRandBytes(vseed.data(), 32); | ||
bool ret = secp256k1_context_randomize(ctx, vseed.data()); | ||
assert(ret); | ||
} | ||
signing_context = ctx; | ||
} | ||
Secp256k1Context::~Secp256k1Context() | ||
{ | ||
assert(verifying_context != NULL); | ||
secp256k1_context_destroy(verifying_context); | ||
verifying_context = NULL; | ||
|
||
secp256k1_context *ctx = signing_context; | ||
signing_context = NULL; | ||
if (ctx) { | ||
secp256k1_context_destroy(ctx); | ||
} | ||
} | ||
|
||
secp256k1_context* Secp256k1Context::GetVerifyContext() | ||
{ | ||
return verifying_context; | ||
} | ||
secp256k1_context* Secp256k1Context::GetSigningContext() | ||
{ | ||
return signing_context; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef SECP256_K1_CONTEXT_H | ||
#define SECP256_K1_CONTEXT_H | ||
#include <secp256k1.h> | ||
#include <secp256k1_recovery.h> | ||
|
||
class Secp256k1Context | ||
{ | ||
private: | ||
secp256k1_context* verifying_context = NULL; | ||
secp256k1_context* signing_context = NULL; | ||
|
||
Secp256k1Context(); | ||
~Secp256k1Context(); | ||
public: | ||
static Secp256k1Context& instance() | ||
{ | ||
static Secp256k1Context uniqueInstance; | ||
return uniqueInstance; | ||
} | ||
|
||
secp256k1_context* GetVerifyContext(); | ||
secp256k1_context* GetSigningContext(); | ||
}; | ||
#endif //SECP256_K1_CONTEXT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef BLOCK_MAP_H | ||
#define BLOCK_MAP_H | ||
#include "chain.h" | ||
#include <boost/unordered_map.hpp> | ||
struct BlockHasher { | ||
size_t operator()(const uint256& hash) const { return hash.GetLow64(); } | ||
}; | ||
class BlockMap: public boost::unordered_map<uint256, CBlockIndex*, BlockHasher> | ||
{ | ||
}; | ||
#endif // BLOCK_MAP_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.