Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libtool \
autotools-dev \
autoconf \
pkg-config \
libssl-dev \
libboost-all-dev \
libsodium-dev \
libminiupnpc-dev \
git \
wget \
&& rm -rf /var/lib/apt/lists/*

# Build BDB 4.8 from source (Bitcoin PPA no longer maintained)
RUN wget -q http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz \
&& echo "12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz" | sha256sum -c \
&& tar -xzf db-4.8.30.NC.tar.gz \
&& sed -i 's/__atomic_compare_exchange/__atomic_compare_exchange_db/g' db-4.8.30.NC/dbinc/atomic.h \
&& cd db-4.8.30.NC/build_unix \
&& ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=/usr/local \
&& make -j$(nproc) \
&& make install \
&& cd / && rm -rf db-4.8.30.NC db-4.8.30.NC.tar.gz

WORKDIR /bitmark

# Copy source
COPY . .

# Clean any previous build artifacts
RUN make clean 2>/dev/null || true
RUN rm -f Makefile src/Makefile

# Build
RUN ./autogen.sh
RUN ./configure --without-gui --disable-tests LDFLAGS="-L/usr/local/lib/" CPPFLAGS="-I/usr/local/include/ -DBOOST_BIND_GLOBAL_PLACEHOLDERS"
RUN make -j$(nproc)

# Output binaries to /output
RUN mkdir -p /output && cp src/bitmarkd src/bitmark-cli /output/
8 changes: 5 additions & 3 deletions src/blake2.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extern "C" {
uint8_t personal[BLAKE2S_PERSONALBYTES]; // 32
} blake2s_param;

ALIGN( 64 ) typedef struct __blake2s_state
typedef struct __blake2s_state
{
uint32_t h[8];
uint32_t t[2];
Expand All @@ -86,7 +86,7 @@ extern "C" {
uint8_t personal[BLAKE2B_PERSONALBYTES]; // 64
} blake2b_param;

ALIGN( 64 ) typedef struct __blake2b_state
typedef struct __blake2b_state
{
uint64_t h[8];
uint64_t t[2];
Expand All @@ -96,6 +96,9 @@ extern "C" {
uint8_t last_node;
} blake2b_state;

#pragma pack(pop)

// These structs contain aligned types, must be outside pack(1)
typedef struct __blake2sp_state
{
blake2s_state S[8][1];
Expand All @@ -111,7 +114,6 @@ extern "C" {
uint8_t buf[4 * BLAKE2B_BLOCKBYTES];
size_t buflen;
} blake2bp_state;
#pragma pack(pop)

// Streaming API
int blake2s_init( blake2s_state *S, const uint8_t outlen );
Expand Down
10 changes: 5 additions & 5 deletions src/blake2s-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen )

int blake2s( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen )
{
blake2s_state S[1];
blake2s_state S;

/* Verify parameters */
if ( NULL == in ) return -1;
Expand All @@ -363,15 +363,15 @@ int blake2s( uint8_t *out, const void *in, const void *key, const uint8_t outlen

if( keylen > 0 )
{
if( blake2s_init_key( S, outlen, key, keylen ) < 0 ) return -1;
if( blake2s_init_key( &S, outlen, key, keylen ) < 0 ) return -1;
}
else
{
if( blake2s_init( S, outlen ) < 0 ) return -1;
if( blake2s_init( &S, outlen ) < 0 ) return -1;
}

blake2s_update( S, ( const uint8_t * )in, inlen );
blake2s_final( S, out, outlen );
blake2s_update( &S, ( const uint8_t * )in, inlen );
blake2s_final( &S, out, outlen );
return 0;
}

Expand Down
20 changes: 10 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,21 +155,21 @@ struct CMainSignals {
}

void RegisterWallet(CWalletInterface* pwalletIn) {
g_signals.SyncTransaction.connect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
g_signals.EraseTransaction.connect(boost::bind(&CWalletInterface::EraseFromWallet, pwalletIn, std::placeholders::_1));
g_signals.UpdatedTransaction.connect(boost::bind(&CWalletInterface::UpdatedTransaction, pwalletIn, std::placeholders::_1));
g_signals.SetBestChain.connect(boost::bind(&CWalletInterface::SetBestChain, pwalletIn, std::placeholders::_1));
g_signals.Inventory.connect(boost::bind(&CWalletInterface::Inventory, pwalletIn, std::placeholders::_1));
g_signals.SyncTransaction.connect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
g_signals.EraseTransaction.connect(boost::bind(&CWalletInterface::EraseFromWallet, pwalletIn, boost::placeholders::_1));
g_signals.UpdatedTransaction.connect(boost::bind(&CWalletInterface::UpdatedTransaction, pwalletIn, boost::placeholders::_1));
g_signals.SetBestChain.connect(boost::bind(&CWalletInterface::SetBestChain, pwalletIn, boost::placeholders::_1));
g_signals.Inventory.connect(boost::bind(&CWalletInterface::Inventory, pwalletIn, boost::placeholders::_1));
g_signals.Broadcast.connect(boost::bind(&CWalletInterface::ResendWalletTransactions, pwalletIn));
}

void UnregisterWallet(CWalletInterface* pwalletIn) {
g_signals.Broadcast.disconnect(boost::bind(&CWalletInterface::ResendWalletTransactions, pwalletIn));
g_signals.Inventory.disconnect(boost::bind(&CWalletInterface::Inventory, pwalletIn, std::placeholders::_1));
g_signals.SetBestChain.disconnect(boost::bind(&CWalletInterface::SetBestChain, pwalletIn, std::placeholders::_1));
g_signals.UpdatedTransaction.disconnect(boost::bind(&CWalletInterface::UpdatedTransaction, pwalletIn, std::placeholders::_1));
g_signals.EraseTransaction.disconnect(boost::bind(&CWalletInterface::EraseFromWallet, pwalletIn, std::placeholders::_1));
g_signals.SyncTransaction.disconnect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
g_signals.Inventory.disconnect(boost::bind(&CWalletInterface::Inventory, pwalletIn, boost::placeholders::_1));
g_signals.SetBestChain.disconnect(boost::bind(&CWalletInterface::SetBestChain, pwalletIn, boost::placeholders::_1));
g_signals.UpdatedTransaction.disconnect(boost::bind(&CWalletInterface::UpdatedTransaction, pwalletIn, boost::placeholders::_1));
g_signals.EraseTransaction.disconnect(boost::bind(&CWalletInterface::EraseFromWallet, pwalletIn, boost::placeholders::_1));
g_signals.SyncTransaction.disconnect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
}

void UnregisterAllWallets() {
Expand Down
4 changes: 2 additions & 2 deletions src/rpcserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ static void RPCListen(boost::shared_ptr< basic_socket_acceptor<Protocol> > accep
boost::ref(context),
fUseSSL,
conn,
_1));
boost::placeholders::_1));
}


Expand Down Expand Up @@ -769,7 +769,7 @@ void RPCRunLater(const std::string& name, boost::function<void(void)> func, int6
boost::shared_ptr<deadline_timer>(new deadline_timer(*rpc_io_service))));
}
deadlineTimers[name]->expires_from_now(posix_time::seconds(nSeconds));
deadlineTimers[name]->async_wait(boost::bind(RPCRunHandler, _1, func));
deadlineTimers[name]->async_wait(boost::bind(RPCRunHandler, boost::placeholders::_1, func));
}

class JSONRequest
Expand Down