-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christian Knöpke
committed
Aug 15, 2017
1 parent
a4b492e
commit c80fcc1
Showing
82 changed files
with
4,107 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
# Custom for Visual Studio | ||
*.cs diff=csharp | ||
|
||
# Standard to msysgit | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain | ||
src/clientversion.cpp export-subst |
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 |
---|---|---|
@@ -1,47 +1,123 @@ | ||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
.gitignore | ||
*.sublime-project | ||
*.sublime-workspace | ||
todo.txt | ||
reset-files.bash | ||
|
||
# Folder config file | ||
Desktop.ini | ||
*.tar.gz | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
*.exe | ||
src/bitcloud | ||
src/bitcloudd | ||
src/bitcloud-cli | ||
src/bitcloud-tx | ||
src/test/test_bitcloud | ||
src/qt/test/test_bitcloud-qt | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
# autoreconf | ||
Makefile.in | ||
aclocal.m4 | ||
autom4te.cache/ | ||
build-aux/config.guess | ||
build-aux/config.sub | ||
build-aux/depcomp | ||
build-aux/install-sh | ||
build-aux/ltmain.sh | ||
build-aux/m4/libtool.m4 | ||
build-aux/m4/lt~obsolete.m4 | ||
build-aux/m4/ltoptions.m4 | ||
build-aux/m4/ltsugar.m4 | ||
build-aux/m4/ltversion.m4 | ||
build-aux/missing | ||
build-aux/compile | ||
build-aux/test-driver | ||
config.log | ||
config.status | ||
configure | ||
libtool | ||
src/config/bitcloud-config.h | ||
src/config/bitcloud-config.h.in | ||
src/config/stamp-h1 | ||
share/setup.nsi | ||
share/qt/Info.plist | ||
contrib/devtools/split-debug.sh | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
src/univalue/gen | ||
|
||
# ========================= | ||
# Operating System Files | ||
# ========================= | ||
src/qt/*.moc | ||
src/qt/moc_*.cpp | ||
src/qt/forms/ui_*.h | ||
|
||
# OSX | ||
# ========================= | ||
src/qt/test/moc*.cpp | ||
|
||
.deps | ||
.dirstamp | ||
.libs | ||
.*.swp | ||
*.*~* | ||
*.bak | ||
*.rej | ||
*.orig | ||
*.pyc | ||
*.o | ||
*.o-* | ||
*.patch | ||
.bitcloud | ||
*.a | ||
*.pb.cc | ||
*.pb.h | ||
|
||
*.log | ||
*.trs | ||
*.dmg | ||
|
||
*.json.h | ||
*.raw.h | ||
|
||
#libtool object files | ||
*.lo | ||
*.la | ||
|
||
# Compilation and Qt preprocessor part | ||
*.qm | ||
Makefile | ||
bitcloud-qt | ||
BTDX-Qt.app | ||
|
||
# Unit-tests | ||
Makefile.test | ||
bitcloud-qt_test | ||
src/test/buildenv.py | ||
|
||
# Resources cpp | ||
qrc_*.cpp | ||
|
||
# Qt creator | ||
*.pro.user | ||
|
||
# Mac specific | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
build | ||
|
||
#lcov | ||
*.gcno | ||
/*.info | ||
test_bitcloud.coverage/ | ||
total.coverage/ | ||
coverage_percent.txt | ||
|
||
#build tests | ||
linux-coverage-build | ||
linux-build | ||
win32-build | ||
qa/pull-tester/run-bitcoind-for-test.sh | ||
qa/pull-tester/tests-config.sh | ||
qa/pull-tester/cache/* | ||
qa/pull-tester/test.*/* | ||
|
||
!src/leveldb*/Makefile | ||
|
||
.cproject | ||
.project | ||
/doc/doxygen/ | ||
/nbproject/ |
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,113 @@ | ||
|
||
#include "Darksend-relay.h" | ||
|
||
|
||
CDarKsendRelay::CDarKsendRelay() | ||
{ | ||
vinMasternode = CTxIn(); | ||
nBlockHeight = 0; | ||
nRelayType = 0; | ||
in = CTxIn(); | ||
out = CTxOut(); | ||
} | ||
|
||
CDarKsendRelay::CDarKsendRelay(CTxIn& vinMasternodeIn, vector<unsigned char>& vchSigIn, int nBlockHeightIn, int nRelayTypeIn, CTxIn& in2, CTxOut& out2) | ||
{ | ||
vinMasternode = vinMasternodeIn; | ||
vchSig = vchSigIn; | ||
nBlockHeight = nBlockHeightIn; | ||
nRelayType = nRelayTypeIn; | ||
in = in2; | ||
out = out2; | ||
} | ||
|
||
std::string CDarKsendRelay::ToString() | ||
{ | ||
std::ostringstream info; | ||
|
||
info << "vin: " << vinMasternode.ToString() << " nBlockHeight: " << (int)nBlockHeight << " nRelayType: " << (int)nRelayType << " in " << in.ToString() << " out " << out.ToString(); | ||
|
||
return info.str(); | ||
} | ||
|
||
bool CDarKsendRelay::Sign(std::string strSharedKey) | ||
{ | ||
std::string strMessage = in.ToString() + out.ToString(); | ||
|
||
CKey key2; | ||
CPubKey pubkey2; | ||
std::string errorMessage = ""; | ||
|
||
if (!DarKsendSigner.SetKey(strSharedKey, errorMessage, key2, pubkey2)) { | ||
LogPrintf("CDarKsendRelay():Sign - ERROR: Invalid shared key: '%s'\n", errorMessage.c_str()); | ||
return false; | ||
} | ||
|
||
if (!DarKsendSigner.SignMessage(strMessage, errorMessage, vchSig2, key2)) { | ||
LogPrintf("CDarKsendRelay():Sign - Sign message failed\n"); | ||
return false; | ||
} | ||
|
||
if (!DarKsendSigner.VerifyMessage(pubkey2, vchSig2, strMessage, errorMessage)) { | ||
LogPrintf("CDarKsendRelay():Sign - Verify message failed\n"); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
bool CDarKsendRelay::VerifyMessage(std::string strSharedKey) | ||
{ | ||
std::string strMessage = in.ToString() + out.ToString(); | ||
|
||
CKey key2; | ||
CPubKey pubkey2; | ||
std::string errorMessage = ""; | ||
|
||
if (!DarKsendSigner.SetKey(strSharedKey, errorMessage, key2, pubkey2)) { | ||
LogPrintf("CDarKsendRelay()::VerifyMessage - ERROR: Invalid shared key: '%s'\n", errorMessage.c_str()); | ||
return false; | ||
} | ||
|
||
if (!DarKsendSigner.VerifyMessage(pubkey2, vchSig2, strMessage, errorMessage)) { | ||
LogPrintf("CDarKsendRelay()::VerifyMessage - Verify message failed\n"); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
void CDarKsendRelay::Relay() | ||
{ | ||
int nCount = std::min(mnodeman.CountEnabled(ActiveProtocol()), 20); | ||
int nRank1 = (rand() % nCount) + 1; | ||
int nRank2 = (rand() % nCount) + 1; | ||
|
||
//keep picking another second number till we get one that doesn't match | ||
while (nRank1 == nRank2) | ||
nRank2 = (rand() % nCount) + 1; | ||
|
||
//printf("rank 1 - rank2 %d %d \n", nRank1, nRank2); | ||
|
||
//relay this message through 2 separate nodes for redundancy | ||
RelayThroughNode(nRank1); | ||
RelayThroughNode(nRank2); | ||
} | ||
|
||
void CDarKsendRelay::RelayThroughNode(int nRank) | ||
{ | ||
CMasternode* pmn = mnodeman.GetMasternodeByRank(nRank, nBlockHeight, ActiveProtocol()); | ||
|
||
if (pmn != NULL) { | ||
//printf("RelayThroughNode %s\n", pmn->addr.ToString().c_str()); | ||
CNode* pnode = ConnectNode((CAddress)pmn->addr, NULL, false); | ||
if (pnode) { | ||
//printf("Connected\n"); | ||
pnode->PushMessage("dsr", (*this)); | ||
pnode->Release(); | ||
return; | ||
} | ||
} else { | ||
//printf("RelayThroughNode NULL\n"); | ||
} | ||
} |
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,52 @@ | ||
|
||
// Copyright (c) 2014-2015 The Dash developers | ||
// Copyright (c) 2015-2017 The BTDX developers | ||
// Distributed under the MIT/X11 software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#ifndef DARKSEND_RELAY_H | ||
#define DARKSEND_RELAY_H | ||
|
||
#include "activemasternode.h" | ||
#include "main.h" | ||
#include "masternodeman.h" | ||
|
||
|
||
class CDarKsendRelay | ||
{ | ||
public: | ||
CTxIn vinMasternode; | ||
vector<unsigned char> vchSig; | ||
vector<unsigned char> vchSig2; | ||
int nBlockHeight; | ||
int nRelayType; | ||
CTxIn in; | ||
CTxOut out; | ||
|
||
CDarKsendRelay(); | ||
CDarKsendRelay(CTxIn& vinMasternodeIn, vector<unsigned char>& vchSigIn, int nBlockHeightIn, int nRelayTypeIn, CTxIn& in2, CTxOut& out2); | ||
|
||
ADD_SERIALIZE_METHODS; | ||
|
||
template <typename Stream, typename Operation> | ||
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) | ||
{ | ||
READWRITE(vinMasternode); | ||
READWRITE(vchSig); | ||
READWRITE(vchSig2); | ||
READWRITE(nBlockHeight); | ||
READWRITE(nRelayType); | ||
READWRITE(in); | ||
READWRITE(out); | ||
} | ||
|
||
std::string ToString(); | ||
|
||
bool Sign(std::string strSharedKey); | ||
bool VerifyMessage(std::string strSharedKey); | ||
void Relay(); | ||
void RelayThroughNode(int nRank); | ||
}; | ||
|
||
|
||
#endif |
Oops, something went wrong.