Skip to content

Commit c80fcc1

Browse files
author
Christian Knöpke
committed
Init2
1 parent a4b492e commit c80fcc1

Some content is hidden

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

82 files changed

+4107
-70
lines changed

.gitattributes

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1 @@
1-
# Auto detect text files and perform LF normalization
2-
* text=auto
3-
4-
# Custom for Visual Studio
5-
*.cs diff=csharp
6-
7-
# Standard to msysgit
8-
*.doc diff=astextplain
9-
*.DOC diff=astextplain
10-
*.docx diff=astextplain
11-
*.DOCX diff=astextplain
12-
*.dot diff=astextplain
13-
*.DOT diff=astextplain
14-
*.pdf diff=astextplain
15-
*.PDF diff=astextplain
16-
*.rtf diff=astextplain
17-
*.RTF diff=astextplain
1+
src/clientversion.cpp export-subst

.gitignore

Lines changed: 115 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,123 @@
1-
# Windows image file caches
2-
Thumbs.db
3-
ehthumbs.db
1+
.gitignore
2+
*.sublime-project
3+
*.sublime-workspace
4+
todo.txt
5+
reset-files.bash
46

5-
# Folder config file
6-
Desktop.ini
7+
*.tar.gz
78

8-
# Recycle Bin used on file shares
9-
$RECYCLE.BIN/
9+
*.exe
10+
src/bitcloud
11+
src/bitcloudd
12+
src/bitcloud-cli
13+
src/bitcloud-tx
14+
src/test/test_bitcloud
15+
src/qt/test/test_bitcloud-qt
1016

11-
# Windows Installer files
12-
*.cab
13-
*.msi
14-
*.msm
15-
*.msp
17+
# autoreconf
18+
Makefile.in
19+
aclocal.m4
20+
autom4te.cache/
21+
build-aux/config.guess
22+
build-aux/config.sub
23+
build-aux/depcomp
24+
build-aux/install-sh
25+
build-aux/ltmain.sh
26+
build-aux/m4/libtool.m4
27+
build-aux/m4/lt~obsolete.m4
28+
build-aux/m4/ltoptions.m4
29+
build-aux/m4/ltsugar.m4
30+
build-aux/m4/ltversion.m4
31+
build-aux/missing
32+
build-aux/compile
33+
build-aux/test-driver
34+
config.log
35+
config.status
36+
configure
37+
libtool
38+
src/config/bitcloud-config.h
39+
src/config/bitcloud-config.h.in
40+
src/config/stamp-h1
41+
share/setup.nsi
42+
share/qt/Info.plist
43+
contrib/devtools/split-debug.sh
1644

17-
# Windows shortcuts
18-
*.lnk
45+
src/univalue/gen
1946

20-
# =========================
21-
# Operating System Files
22-
# =========================
47+
src/qt/*.moc
48+
src/qt/moc_*.cpp
49+
src/qt/forms/ui_*.h
2350

24-
# OSX
25-
# =========================
51+
src/qt/test/moc*.cpp
2652

53+
.deps
54+
.dirstamp
55+
.libs
56+
.*.swp
57+
*.*~*
58+
*.bak
59+
*.rej
60+
*.orig
61+
*.pyc
62+
*.o
63+
*.o-*
64+
*.patch
65+
.bitcloud
66+
*.a
67+
*.pb.cc
68+
*.pb.h
69+
70+
*.log
71+
*.trs
72+
*.dmg
73+
74+
*.json.h
75+
*.raw.h
76+
77+
#libtool object files
78+
*.lo
79+
*.la
80+
81+
# Compilation and Qt preprocessor part
82+
*.qm
83+
Makefile
84+
bitcloud-qt
85+
BTDX-Qt.app
86+
87+
# Unit-tests
88+
Makefile.test
89+
bitcloud-qt_test
90+
src/test/buildenv.py
91+
92+
# Resources cpp
93+
qrc_*.cpp
94+
95+
# Qt creator
96+
*.pro.user
97+
98+
# Mac specific
2799
.DS_Store
28-
.AppleDouble
29-
.LSOverride
30-
31-
# Thumbnails
32-
._*
33-
34-
# Files that might appear in the root of a volume
35-
.DocumentRevisions-V100
36-
.fseventsd
37-
.Spotlight-V100
38-
.TemporaryItems
39-
.Trashes
40-
.VolumeIcon.icns
41-
42-
# Directories potentially created on remote AFP share
43-
.AppleDB
44-
.AppleDesktop
45-
Network Trash Folder
46-
Temporary Items
47-
.apdisk
100+
build
101+
102+
#lcov
103+
*.gcno
104+
/*.info
105+
test_bitcloud.coverage/
106+
total.coverage/
107+
coverage_percent.txt
108+
109+
#build tests
110+
linux-coverage-build
111+
linux-build
112+
win32-build
113+
qa/pull-tester/run-bitcoind-for-test.sh
114+
qa/pull-tester/tests-config.sh
115+
qa/pull-tester/cache/*
116+
qa/pull-tester/test.*/*
117+
118+
!src/leveldb*/Makefile
119+
120+
.cproject
121+
.project
122+
/doc/doxygen/
123+
/nbproject/

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
22
AC_PREREQ([2.60])
3-
define(_CLIENT_VERSION_MAJOR, 2)
3+
define(_CLIENT_VERSION_MAJOR, 3)
44
define(_CLIENT_VERSION_MINOR, 0)
55
define(_CLIENT_VERSION_REVISION, 0)
6-
define(_CLIENT_VERSION_BUILD, 0)
6+
define(_CLIENT_VERSION_BUILD, 4)
77
define(_CLIENT_VERSION_IS_RELEASE, true)
88
define(_COPYRIGHT_YEAR, 2017)
99
AC_INIT([Diamond Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[http://bit.bitclouds],[bitcloud])

src/Darksend-relay.cpp

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
2+
#include "Darksend-relay.h"
3+
4+
5+
CDarKsendRelay::CDarKsendRelay()
6+
{
7+
vinMasternode = CTxIn();
8+
nBlockHeight = 0;
9+
nRelayType = 0;
10+
in = CTxIn();
11+
out = CTxOut();
12+
}
13+
14+
CDarKsendRelay::CDarKsendRelay(CTxIn& vinMasternodeIn, vector<unsigned char>& vchSigIn, int nBlockHeightIn, int nRelayTypeIn, CTxIn& in2, CTxOut& out2)
15+
{
16+
vinMasternode = vinMasternodeIn;
17+
vchSig = vchSigIn;
18+
nBlockHeight = nBlockHeightIn;
19+
nRelayType = nRelayTypeIn;
20+
in = in2;
21+
out = out2;
22+
}
23+
24+
std::string CDarKsendRelay::ToString()
25+
{
26+
std::ostringstream info;
27+
28+
info << "vin: " << vinMasternode.ToString() << " nBlockHeight: " << (int)nBlockHeight << " nRelayType: " << (int)nRelayType << " in " << in.ToString() << " out " << out.ToString();
29+
30+
return info.str();
31+
}
32+
33+
bool CDarKsendRelay::Sign(std::string strSharedKey)
34+
{
35+
std::string strMessage = in.ToString() + out.ToString();
36+
37+
CKey key2;
38+
CPubKey pubkey2;
39+
std::string errorMessage = "";
40+
41+
if (!DarKsendSigner.SetKey(strSharedKey, errorMessage, key2, pubkey2)) {
42+
LogPrintf("CDarKsendRelay():Sign - ERROR: Invalid shared key: '%s'\n", errorMessage.c_str());
43+
return false;
44+
}
45+
46+
if (!DarKsendSigner.SignMessage(strMessage, errorMessage, vchSig2, key2)) {
47+
LogPrintf("CDarKsendRelay():Sign - Sign message failed\n");
48+
return false;
49+
}
50+
51+
if (!DarKsendSigner.VerifyMessage(pubkey2, vchSig2, strMessage, errorMessage)) {
52+
LogPrintf("CDarKsendRelay():Sign - Verify message failed\n");
53+
return false;
54+
}
55+
56+
return true;
57+
}
58+
59+
bool CDarKsendRelay::VerifyMessage(std::string strSharedKey)
60+
{
61+
std::string strMessage = in.ToString() + out.ToString();
62+
63+
CKey key2;
64+
CPubKey pubkey2;
65+
std::string errorMessage = "";
66+
67+
if (!DarKsendSigner.SetKey(strSharedKey, errorMessage, key2, pubkey2)) {
68+
LogPrintf("CDarKsendRelay()::VerifyMessage - ERROR: Invalid shared key: '%s'\n", errorMessage.c_str());
69+
return false;
70+
}
71+
72+
if (!DarKsendSigner.VerifyMessage(pubkey2, vchSig2, strMessage, errorMessage)) {
73+
LogPrintf("CDarKsendRelay()::VerifyMessage - Verify message failed\n");
74+
return false;
75+
}
76+
77+
return true;
78+
}
79+
80+
void CDarKsendRelay::Relay()
81+
{
82+
int nCount = std::min(mnodeman.CountEnabled(ActiveProtocol()), 20);
83+
int nRank1 = (rand() % nCount) + 1;
84+
int nRank2 = (rand() % nCount) + 1;
85+
86+
//keep picking another second number till we get one that doesn't match
87+
while (nRank1 == nRank2)
88+
nRank2 = (rand() % nCount) + 1;
89+
90+
//printf("rank 1 - rank2 %d %d \n", nRank1, nRank2);
91+
92+
//relay this message through 2 separate nodes for redundancy
93+
RelayThroughNode(nRank1);
94+
RelayThroughNode(nRank2);
95+
}
96+
97+
void CDarKsendRelay::RelayThroughNode(int nRank)
98+
{
99+
CMasternode* pmn = mnodeman.GetMasternodeByRank(nRank, nBlockHeight, ActiveProtocol());
100+
101+
if (pmn != NULL) {
102+
//printf("RelayThroughNode %s\n", pmn->addr.ToString().c_str());
103+
CNode* pnode = ConnectNode((CAddress)pmn->addr, NULL, false);
104+
if (pnode) {
105+
//printf("Connected\n");
106+
pnode->PushMessage("dsr", (*this));
107+
pnode->Release();
108+
return;
109+
}
110+
} else {
111+
//printf("RelayThroughNode NULL\n");
112+
}
113+
}

src/Darksend-relay.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
// Copyright (c) 2014-2015 The Dash developers
3+
// Copyright (c) 2015-2017 The BTDX developers
4+
// Distributed under the MIT/X11 software license, see the accompanying
5+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
6+
7+
#ifndef DARKSEND_RELAY_H
8+
#define DARKSEND_RELAY_H
9+
10+
#include "activemasternode.h"
11+
#include "main.h"
12+
#include "masternodeman.h"
13+
14+
15+
class CDarKsendRelay
16+
{
17+
public:
18+
CTxIn vinMasternode;
19+
vector<unsigned char> vchSig;
20+
vector<unsigned char> vchSig2;
21+
int nBlockHeight;
22+
int nRelayType;
23+
CTxIn in;
24+
CTxOut out;
25+
26+
CDarKsendRelay();
27+
CDarKsendRelay(CTxIn& vinMasternodeIn, vector<unsigned char>& vchSigIn, int nBlockHeightIn, int nRelayTypeIn, CTxIn& in2, CTxOut& out2);
28+
29+
ADD_SERIALIZE_METHODS;
30+
31+
template <typename Stream, typename Operation>
32+
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
33+
{
34+
READWRITE(vinMasternode);
35+
READWRITE(vchSig);
36+
READWRITE(vchSig2);
37+
READWRITE(nBlockHeight);
38+
READWRITE(nRelayType);
39+
READWRITE(in);
40+
READWRITE(out);
41+
}
42+
43+
std::string ToString();
44+
45+
bool Sign(std::string strSharedKey);
46+
bool VerifyMessage(std::string strSharedKey);
47+
void Relay();
48+
void RelayThroughNode(int nRank);
49+
};
50+
51+
52+
#endif

0 commit comments

Comments
 (0)