mirror of
https://git.wownero.com/wownero/wownero-puddle.git
synced 2024-08-15 01:03:20 +00:00
Merge branch 'dev'
This commit is contained in:
commit
0de8aaffcd
14 changed files with 1551 additions and 1205 deletions
4
LICENSE
4
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2014-2018, The Monero Project
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -28,4 +28,4 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
||||
developers
|
||||
developers.
|
||||
|
|
70
Makefile
70
Makefile
|
@ -1,3 +1,39 @@
|
|||
define LICENSE
|
||||
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
||||
developers.
|
||||
|
||||
endef
|
||||
|
||||
TARGET = monero-pool
|
||||
|
||||
TYPE = debug
|
||||
|
@ -6,7 +42,14 @@ ifeq ($(MAKECMDGOALS),release)
|
|||
TYPE = release
|
||||
endif
|
||||
|
||||
MONERO_INC = ${MONERO_ROOT}/src ${MONERO_ROOT}/external/easylogging++ ${MONERO_ROOT}/contrib/epee/include
|
||||
MONERO_BUILD_ROOT = ${MONERO_ROOT}/build/$(shell echo `uname | \
|
||||
sed -e 's|[:/\\ \(\)]|_|g'`/`\
|
||||
git -C ${MONERO_ROOT} branch | grep '\* ' | cut -f2- -d' '| \
|
||||
sed -e 's|[:/\\ \(\)]|_|g'`)/release
|
||||
|
||||
MONERO_INC = ${MONERO_ROOT}/src \
|
||||
${MONERO_ROOT}/external/easylogging++ \
|
||||
${MONERO_ROOT}/contrib/epee/include
|
||||
|
||||
MONERO_LIBS = \
|
||||
${MONERO_BUILD_ROOT}/src/cryptonote_basic/libcryptonote_basic.a \
|
||||
|
@ -56,9 +99,11 @@ LDPARAM += $(LDFLAGS)
|
|||
|
||||
LIBS := lmdb pthread microhttpd unbound
|
||||
ifeq ($(OS), Darwin)
|
||||
LIBS += c++ boost_system-mt boost_date_time-mt boost_chrono-mt boost_filesystem-mt boost_thread-mt boost_regex-mt
|
||||
LIBS += c++ boost_system-mt boost_date_time-mt boost_chrono-mt \
|
||||
boost_filesystem-mt boost_thread-mt boost_regex-mt
|
||||
else
|
||||
LIBS += dl boost_system boost_date_time boost_chrono boost_filesystem boost_thread boost_regex uuid
|
||||
LIBS += dl boost_system boost_date_time boost_chrono boost_filesystem \
|
||||
boost_thread boost_regex uuid
|
||||
endif
|
||||
|
||||
PKG_LIBS := $(shell pkg-config \
|
||||
|
@ -105,14 +150,21 @@ SDFILES := $(addprefix $(STORE)/,$(CSOURCE:.S=.d))
|
|||
|
||||
$(TARGET): preflight dirs $(OBJECTS) $(COBJECTS) $(SOBJECTS) $(HTMLOBJECTS)
|
||||
@echo Linking $(OBJECTS)...
|
||||
$(C++) -o $(STORE)/$(TARGET) $(OBJECTS) $(COBJECTS) $(SOBJECTS) $(HTMLOBJECTS) $(LDPARAM) $(MONERO_LIBS) $(foreach LIBRARY, $(LIBS),-l$(LIBRARY)) $(foreach LIB,$(LIBPATH),-L$(LIB)) $(PKG_LIBS) $(STATIC_LIBS)
|
||||
$(C++) -o $(STORE)/$(TARGET) $(OBJECTS) $(COBJECTS) $(SOBJECTS) $(HTMLOBJECTS) \
|
||||
$(LDPARAM) $(MONERO_LIBS) \
|
||||
$(foreach LIBRARY, $(LIBS),-l$(LIBRARY)) \
|
||||
$(foreach LIB,$(LIBPATH),-L$(LIB)) \
|
||||
$(PKG_LIBS) $(STATIC_LIBS)
|
||||
@cp pool.conf $(STORE)/
|
||||
@cp tools/* $(STORE)/
|
||||
|
||||
$(STORE)/%.o: %.cpp
|
||||
@echo Creating object file for $*...
|
||||
$(C++) -Wp,-MMD,$(STORE)/$*.dd $(CCPARAM) $(CXXFLAGS) $(foreach INC,$(INCPATH),-I$(INC)) $(PKG_INC)\
|
||||
$(foreach CPPDEF,$(CPPDEFS),-D$(CPPDEF)) -c $< -o $@
|
||||
$(C++) -Wp,-MMD,$(STORE)/$*.dd $(CCPARAM) $(CXXFLAGS) \
|
||||
$(foreach INC,$(INCPATH),-I$(INC)) \
|
||||
$(PKG_INC) \
|
||||
$(foreach CPPDEF,$(CPPDEFS),-D$(CPPDEF)) \
|
||||
-c $< -o $@
|
||||
@sed -e '1s/^\(.*\)$$/$(subst /,\/,$(dir $@))\1/' $(STORE)/$*.dd > $(STORE)/$*.d
|
||||
@rm -f $(STORE)/$*.dd
|
||||
|
||||
|
@ -149,15 +201,13 @@ clean:
|
|||
|
||||
dirs:
|
||||
@-if [ ! -e $(STORE) ]; then mkdir -p $(STORE); fi;
|
||||
@-$(foreach DIR,$(DIRS), if [ ! -e $(STORE)/$(DIR) ]; then mkdir -p $(STORE)/$(DIR); fi; )
|
||||
@-$(foreach DIR,$(DIRS), \
|
||||
if [ ! -e $(STORE)/$(DIR) ]; then mkdir -p $(STORE)/$(DIR); fi; )
|
||||
|
||||
preflight:
|
||||
ifeq ($(origin MONERO_ROOT), undefined)
|
||||
$(error You need to set an environment variable MONERO_ROOT to your monero repository root)
|
||||
endif
|
||||
ifeq ($(origin MONERO_BUILD_ROOT), undefined)
|
||||
$(error You need to set an environment variable MONERO_BUILD_ROOT to your monero build root)
|
||||
endif
|
||||
ifndef PKG_LIBS
|
||||
$(error Missing dependencies)
|
||||
endif
|
||||
|
|
|
@ -34,14 +34,13 @@ shout on IRC: jtgrassie on Freenode.
|
|||
The build system now requires the Monero source tree to be cloned and compiled.
|
||||
Follow the
|
||||
[instructions](https://github.com/monero-project/monero#compiling-monero-from-source)
|
||||
for compiling Monero, then export the following variables:
|
||||
for compiling Monero, then export the following variable:
|
||||
|
||||
```bash
|
||||
export MONERO_ROOT=/path/to/cloned/monero
|
||||
export MONERO_BUILD_ROOT=$MONERO_ROOT/build/<system>/<branch>/<release|debug>
|
||||
```
|
||||
|
||||
Replacing the values appropriately.
|
||||
Replacing the path appropriately.
|
||||
|
||||
Beyond the Monero dependencies, the following extra libraries are also required
|
||||
to build the pool:
|
||||
|
|
153
src/bstack.c
Normal file
153
src/bstack.c
Normal file
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
||||
developers.
|
||||
*/
|
||||
|
||||
#include "bstack.h"
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct bstack_t
|
||||
{
|
||||
size_t c;
|
||||
size_t cc;
|
||||
size_t z;
|
||||
size_t n;
|
||||
size_t ni;
|
||||
recycle_fun rf;
|
||||
char * b;
|
||||
};
|
||||
|
||||
void
|
||||
bstack_new(bstack_t **out, size_t count, size_t size, recycle_fun recycle)
|
||||
{
|
||||
assert(*out==NULL);
|
||||
bstack_t *q = (bstack_t*) calloc(1, sizeof(bstack_t));
|
||||
q->c = count;
|
||||
q->cc = 0;
|
||||
q->z = size;
|
||||
q->b = (char*) calloc(q->c, q->z);
|
||||
q->n = 0;
|
||||
q->ni = 0;
|
||||
q->rf = recycle;
|
||||
*out = q;
|
||||
}
|
||||
|
||||
void
|
||||
bstack_free(bstack_t *q)
|
||||
{
|
||||
assert(q);
|
||||
if (q->rf)
|
||||
{
|
||||
char *ps = q->b;
|
||||
char *pe = ps + (q->cc * q->z);
|
||||
while (ps < pe)
|
||||
{
|
||||
q->rf(ps);
|
||||
ps += q->z;
|
||||
}
|
||||
}
|
||||
free(q->b);
|
||||
free(q);
|
||||
}
|
||||
|
||||
void *
|
||||
bstack_push(bstack_t *q, void *item)
|
||||
{
|
||||
assert(q);
|
||||
size_t idx = q->n++ % q->c;
|
||||
void *pb = q->b + (idx * q->z);
|
||||
if (q->rf && q->cc == q->c)
|
||||
q->rf(pb);
|
||||
if (item)
|
||||
memcpy(pb, item, q->z);
|
||||
else
|
||||
memset(pb, 0, q->z);
|
||||
if (q->cc < q->c)
|
||||
q->cc++;
|
||||
q->ni = q->cc;
|
||||
return pb;
|
||||
}
|
||||
|
||||
void
|
||||
bstack_drop(bstack_t *q)
|
||||
{
|
||||
assert(q);
|
||||
if (!q->cc)
|
||||
return;
|
||||
q->n--;
|
||||
size_t idx = (q->n - q->cc) % q->c;
|
||||
void *pb = q->b + (idx * q->z);
|
||||
q->cc--;
|
||||
if (q->rf)
|
||||
q->rf(pb);
|
||||
}
|
||||
|
||||
void *
|
||||
bstack_peek(bstack_t *q)
|
||||
{
|
||||
assert(q);
|
||||
if (!q->cc)
|
||||
return NULL;
|
||||
size_t idx = (q->n - (q->cc + 1)) % q->c;
|
||||
if (q->cc < q->c)
|
||||
idx = q->cc-1;
|
||||
void *pb = idx ? q->b + (idx * q->z) : q->b;
|
||||
return pb;
|
||||
}
|
||||
|
||||
size_t bstack_count(bstack_t *q)
|
||||
{
|
||||
assert(q);
|
||||
return q->cc;
|
||||
}
|
||||
|
||||
void *
|
||||
bstack_next(bstack_t *q)
|
||||
{
|
||||
assert(q);
|
||||
if (!q->ni)
|
||||
return NULL;
|
||||
q->ni--;
|
||||
size_t idx = (q->n - (q->cc - q->ni)) % q->c;
|
||||
void *pb = idx ? q->b + (idx * q->z) : q->b;
|
||||
return pb;
|
||||
}
|
||||
|
||||
void
|
||||
bstack_reset(bstack_t *q)
|
||||
{
|
||||
assert(q);
|
||||
q->ni = q->cc;
|
||||
}
|
||||
|
54
src/bstack.h
Normal file
54
src/bstack.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
||||
developers.
|
||||
*/
|
||||
|
||||
/* Bounded Stack */
|
||||
|
||||
#ifndef BSTACK_H
|
||||
#define BSTACK_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct bstack_t bstack_t;
|
||||
typedef void (*recycle_fun)(void*);
|
||||
|
||||
void bstack_new(bstack_t **out, size_t count, size_t size, recycle_fun recycle);
|
||||
void bstack_free(bstack_t *q);
|
||||
void * bstack_push(bstack_t *q, void *item);
|
||||
void bstack_drop(bstack_t *q);
|
||||
void * bstack_peek(bstack_t *q);
|
||||
size_t bstack_count(bstack_t *q);
|
||||
void * bstack_next(bstack_t *q);
|
||||
void bstack_reset(bstack_t *q);
|
||||
|
||||
#endif
|
2011
src/pool.c
2011
src/pool.c
File diff suppressed because it is too large
Load diff
46
src/pool.h
46
src/pool.h
|
@ -1,33 +1,35 @@
|
|||
/*
|
||||
Copyright (c) 2014-2018, The Monero Project
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
||||
developers.
|
||||
*/
|
||||
|
||||
#ifndef POOL_H
|
||||
|
|
46
src/util.c
46
src/util.c
|
@ -1,33 +1,35 @@
|
|||
/*
|
||||
Copyright (c) 2014-2018, The Monero Project
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
||||
developers.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
|
46
src/util.h
46
src/util.h
|
@ -1,33 +1,35 @@
|
|||
/*
|
||||
Copyright (c) 2014-2018, The Monero Project
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
||||
developers.
|
||||
*/
|
||||
|
||||
#ifndef UTIL_H
|
||||
|
|
54
src/webui.c
54
src/webui.c
|
@ -1,33 +1,35 @@
|
|||
/*
|
||||
Copyright (c) 2014-2018, The Monero Project
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
||||
developers.
|
||||
*/
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
|
@ -75,7 +77,8 @@ send_json_stats (void *cls, struct MHD_Connection *connection)
|
|||
uint32_t pbf = context->pool_stats->pool_blocks_found;
|
||||
uint64_t mh = 0;
|
||||
double mb = 0.0;
|
||||
const char *wa = MHD_lookup_connection_value(connection, MHD_COOKIE_KIND, "wa");
|
||||
const char *wa = MHD_lookup_connection_value(connection,
|
||||
MHD_COOKIE_KIND, "wa");
|
||||
if (wa != NULL)
|
||||
{
|
||||
mh = miner_hr(wa);
|
||||
|
@ -127,13 +130,14 @@ int
|
|||
start_web_ui(wui_context_t *context)
|
||||
{
|
||||
log_debug("Starting Web UI");
|
||||
mhd_daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, context->port, NULL, NULL,
|
||||
mhd_daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY,
|
||||
context->port, NULL, NULL,
|
||||
&answer_to_connection, (void*) context, MHD_OPTION_END);
|
||||
return mhd_daemon != NULL ? 0 : -1;
|
||||
}
|
||||
|
||||
void
|
||||
stop_web_ui()
|
||||
stop_web_ui(void)
|
||||
{
|
||||
log_debug("Stopping Web UI");
|
||||
if (mhd_daemon != NULL)
|
||||
|
|
48
src/webui.h
48
src/webui.h
|
@ -1,33 +1,35 @@
|
|||
/*
|
||||
Copyright (c) 2014-2018, The Monero Project
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
||||
developers.
|
||||
*/
|
||||
|
||||
#ifndef WEBUI_H
|
||||
|
@ -54,6 +56,6 @@ typedef struct wui_context_t
|
|||
} wui_context_t;
|
||||
|
||||
int start_web_ui(wui_context_t *context);
|
||||
void stop_web_ui();
|
||||
void stop_web_ui(void);
|
||||
|
||||
#endif
|
||||
|
|
55
src/xmr.cpp
55
src/xmr.cpp
|
@ -1,33 +1,35 @@
|
|||
/*
|
||||
Copyright (c) 2014-2018, The Monero Project
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
||||
developers.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -50,7 +52,8 @@
|
|||
|
||||
using namespace cryptonote;
|
||||
|
||||
int get_hashing_blob(const char *input, const size_t in_size, char **output, size_t *out_size)
|
||||
int get_hashing_blob(const char *input, const size_t in_size,
|
||||
char **output, size_t *out_size)
|
||||
{
|
||||
block b = AUTO_VAL_INIT(b);
|
||||
blobdata bd = std::string(input, in_size);
|
||||
|
@ -79,8 +82,10 @@ int parse_address(const char *input, uint64_t *prefix)
|
|||
return rv ? 0 : -1;
|
||||
}
|
||||
|
||||
void get_hash(const char *input, const size_t in_size, char **output, int variant, uint64_t height)
|
||||
void get_hash(const char *input, const size_t in_size,
|
||||
char **output, int variant, uint64_t height)
|
||||
{
|
||||
crypto::cn_slow_hash(input, in_size, reinterpret_cast<crypto::hash&>(*output), variant, height);
|
||||
crypto::cn_slow_hash(input, in_size,
|
||||
reinterpret_cast<crypto::hash&>(*output), variant, height);
|
||||
}
|
||||
|
||||
|
|
52
src/xmr.h
52
src/xmr.h
|
@ -1,33 +1,35 @@
|
|||
/*
|
||||
Copyright (c) 2014-2018, The Monero Project
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
||||
developers.
|
||||
*/
|
||||
|
||||
#ifndef XMR_H
|
||||
|
@ -37,9 +39,11 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
int get_hashing_blob(const char *input, const size_t in_size, char **output, size_t *out_size);
|
||||
int get_hashing_blob(const char *input, const size_t in_size,
|
||||
char **output, size_t *out_size);
|
||||
int parse_address(const char *input, uint64_t *prefix);
|
||||
void get_hash(const char *input, const size_t in_size, char **output, int variant, uint64_t height);
|
||||
void get_hash(const char *input, const size_t in_size,
|
||||
char **output, int variant, uint64_t height);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
114
tools/inspect-data
vendored
114
tools/inspect-data
vendored
|
@ -1,22 +1,90 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
'''
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
||||
developers.
|
||||
'''
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import lmdb
|
||||
import struct
|
||||
from ctypes import *
|
||||
from datetime import datetime
|
||||
|
||||
class share_t(Structure):
|
||||
_fields_ = [('height', c_longlong),
|
||||
('difficulty', c_longlong),
|
||||
('address', c_char*128),
|
||||
('timestamp', c_longlong)]
|
||||
|
||||
class payment_t(Structure):
|
||||
_fields_ = [('amount', c_longlong),
|
||||
('timestamp', c_longlong),
|
||||
('address', c_char*128)]
|
||||
|
||||
class block_t(Structure):
|
||||
_fields_ = [('height', c_longlong),
|
||||
('hash', c_char*64),
|
||||
('prev_hash', c_char*64),
|
||||
('difficulty', c_longlong),
|
||||
('status', c_long),
|
||||
('reward', c_longlong),
|
||||
('timestamp', c_longlong)]
|
||||
|
||||
def format_block_status(status):
|
||||
s = ["LOCKED", "UNLOCKED", "ORPHANED"]
|
||||
return s[status]
|
||||
|
||||
def format_timestamp(timestamp):
|
||||
dt = datetime.fromtimestamp(timestamp)
|
||||
return dt.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
def format_amount(amount):
|
||||
return '{0:.6f}'.format(amount/1e12)
|
||||
|
||||
def format_address(address):
|
||||
return '{}...{}'.format(address[:8], address[-8:])
|
||||
|
||||
def address_from_key(key):
|
||||
return key.decode('utf-8').rstrip('\0')
|
||||
|
||||
def print_balance(path):
|
||||
env = lmdb.open(path, readonly=True, max_dbs=1, create=False)
|
||||
balance = env.open_db('balance'.encode())
|
||||
with env.begin(db=balance) as txn:
|
||||
with txn.cursor() as curs:
|
||||
for key, value in curs:
|
||||
address = key.decode('utf-8').rstrip('\0')
|
||||
address = '{}...{}'.format(address[:8], address[-8:])
|
||||
address = format_address(address_from_key(key))
|
||||
amount = c_longlong.from_buffer_copy(value).value
|
||||
amount = '{0:.6f}'.format(amount/1e12)
|
||||
amount = format_amount(amount)
|
||||
print('{}\t{}'.format(address, amount))
|
||||
env.close()
|
||||
|
||||
|
@ -26,26 +94,44 @@ def print_payements(path):
|
|||
with env.begin(db=payments) as txn:
|
||||
with txn.cursor() as curs:
|
||||
for key, value in curs:
|
||||
address = key.decode('utf-8').rstrip('\0')
|
||||
address = '{}...{}'.format(address[:8], address[-8:])
|
||||
amount, ts, addr = struct.unpack("Q Q 128s", value)
|
||||
amount = '{0:.6f}'.format(amount/1e12)
|
||||
dt = datetime.fromtimestamp(ts)
|
||||
print('{}\t{}\t{}'.format(address, amount,
|
||||
dt.strftime('%Y-%m-%d %H:%M:%S')))
|
||||
address = format_address(address_from_key(key))
|
||||
p = payment_t.from_buffer_copy(value)
|
||||
amount = format_amount(p.amount)
|
||||
dt = format_timestamp(p.timestamp)
|
||||
print('{}\t{}\t{}'.format(address, amount, dt))
|
||||
env.close()
|
||||
|
||||
def print_mined(path):
|
||||
env = lmdb.open(path, readonly=True, max_dbs=1, create=False)
|
||||
blocks = env.open_db('blocks'.encode())
|
||||
with env.begin(db=blocks) as txn:
|
||||
with txn.cursor() as curs:
|
||||
for key, value in curs:
|
||||
height = c_longlong.from_buffer_copy(key).value
|
||||
b = block_t.from_buffer_copy(value)
|
||||
dt = format_timestamp(b.timestamp)
|
||||
reward = format_amount(b.reward)
|
||||
status = format_block_status(b.status)
|
||||
print('{}\t{}\t{}\t{}'.format(height, status, reward, dt))
|
||||
env.close()
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument('-b', '--balances', action='store_true', help='list miner balances')
|
||||
group.add_argument('-p', '--payments', action='store_true', help='list payments made')
|
||||
group.add_argument('-b', '--balances', action='store_true',
|
||||
help='list miner balances')
|
||||
group.add_argument('-p', '--payments', action='store_true',
|
||||
help='list payments made')
|
||||
group.add_argument('-m', '--mined', action='store_true',
|
||||
help='list mined blocks')
|
||||
parser.add_argument('database', help='path to database')
|
||||
args = parser.parse_args()
|
||||
if args.balances:
|
||||
print_balance(args.database)
|
||||
elif args.payments:
|
||||
print_payements(args.database)
|
||||
elif args.mined:
|
||||
print_mined(args.database)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue