Skip to content
Merged
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
32 changes: 23 additions & 9 deletions DigitalNote.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = DigitalNote-qt
VERSION = 1.0.2.0
VERSION = 1.0.2.2
INCLUDEPATH += src src/json src/qt src/qt/plugins/mrichtexteditor
QT += core gui widgets network printsupport
DEFINES += ENABLE_WALLET
Expand All @@ -17,17 +17,17 @@ greaterThan(QT_MAJOR_VERSION, 4) {
}

win32{
BOOST_LIB_SUFFIX=-mgw81-mt-s-x32-1_68
BOOST_INCLUDE_PATH=C:/deps/boost_1_68_0
BOOST_LIB_PATH=C:/deps/boost_1_68_0/stage/lib
BOOST_LIB_SUFFIX=-mgw81-mt-s-x32-1_71
BOOST_INCLUDE_PATH=C:/deps/boost_1_71_0
BOOST_LIB_PATH=C:/deps/boost_1_71_0/stage/lib
BDB_INCLUDE_PATH=C:/deps/db-6.2.32.NC/build_unix
BDB_LIB_PATH=C:/deps/db-6.2.32.NC/build_unix
OPENSSL_INCLUDE_PATH=C:/deps/openssl-1.0.2o/include
OPENSSL_LIB_PATH=C:/deps/openssl-1.0.2o
OPENSSL_INCLUDE_PATH=C:/deps/openssl-1.0.2t/include
OPENSSL_LIB_PATH=C:/deps/openssl-1.0.2t
MINIUPNPC_INCLUDE_PATH=C:/deps/
MINIUPNPC_LIB_PATH=C:/deps/miniupnpc-1.9
QRENCODE_INCLUDE_PATH=C:/deps/qrencode-3.4.4
QRENCODE_LIB_PATH=C:/deps/qrencode-3.4.4/.libs
MINIUPNPC_LIB_PATH=C:/deps/miniupnpc-2.1
QRENCODE_INCLUDE_PATH=C:/deps/qrencode-4.0.2
QRENCODE_LIB_PATH=C:/deps/qrencode-4.0.2/.libs
SECP256K1_INCLUDE_PATH=C:/deps/secp256k1/include
SECP256K1_LIB_PATH=C:/deps/secp256k1
}
Expand Down Expand Up @@ -326,6 +326,11 @@ HEADERS += src/qt/bitcoingui.h \
src/qt/addeditadrenalinenode.h \
src/qt/adrenalinenodeconfigdialog.h \
src/qt/qcustomplot.h \
src/smessage.h \
src/qt/messagepage.h \
src/qt/messagemodel.h \
src/qt/sendmessagesdialog.h \
src/qt/sendmessagesentry.h \
src/qt/blockbrowser.h \
src/qt/plugins/mrichtexteditor/mrichtextedit.h \
src/qt/qvalidatedtextedit.h \
Expand Down Expand Up @@ -443,9 +448,15 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \
src/qt/addeditadrenalinenode.cpp \
src/qt/adrenalinenodeconfigdialog.cpp \
src/qt/qcustomplot.cpp \
src/smessage.cpp \
src/qt/messagepage.cpp \
src/qt/messagemodel.cpp \
src/qt/sendmessagesdialog.cpp \
src/qt/sendmessagesentry.cpp \
src/qt/blockbrowser.cpp \
src/qt/qvalidatedtextedit.cpp \
src/qt/plugins/mrichtexteditor/mrichtextedit.cpp \
src/rpcsmessage.cpp \
src/crypto/common/aes_helper.c \
src/crypto/common/bmw.c \
src/crypto/common/echo.c
Expand All @@ -471,6 +482,9 @@ FORMS += \
src/qt/forms/masternodemanager.ui \
src/qt/forms/addeditadrenalinenode.ui \
src/qt/forms/adrenalinenodeconfigdialog.ui \
src/qt/forms/messagepage.ui \
src/qt/forms/sendmessagesentry.ui \
src/qt/forms/sendmessagesdialog.ui \
src/qt/forms/blockbrowser.ui \
src/qt/plugins/mrichtexteditor/mrichtextedit.ui

Expand Down
14 changes: 12 additions & 2 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,18 @@ class CMainParams : public CChainParams {
base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container<std::vector<unsigned char> >();
base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container<std::vector<unsigned char> >();

//vSeeds.push_back(CDNSSeedData("node1", ""));
//vSeeds.push_back(CDNSSeedData("node2", ""));
vSeeds.push_back(CDNSSeedData("node0", "138.197.161.183"));
vSeeds.push_back(CDNSSeedData("node1", "157.230.107.144"));
vSeeds.push_back(CDNSSeedData("node1", "188.166.123.46"));
vSeeds.push_back(CDNSSeedData("node1", "159.203.14.113"));
vSeeds.push_back(CDNSSeedData("node1", "199.175.54.187"));
vSeeds.push_back(CDNSSeedData("node1", "157.230.107.144"));
vSeeds.push_back(CDNSSeedData("node1", "138.197.161.183"));
vSeeds.push_back(CDNSSeedData("node2", "seed1n.digitalnote.biz"));
vSeeds.push_back(CDNSSeedData("node3", "seed2n.digitalnote.biz"));
vSeeds.push_back(CDNSSeedData("node4", "seed3n.digitalnote.biz"));
vSeeds.push_back(CDNSSeedData("node5", "seed4n.digitalnote.biz"));

convertSeed6(vFixedSeeds, pnSeed6_main, ARRAYLEN(pnSeed6_main));

nPoolMaxTransactions = 9;
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define CLIENT_VERSION_MAJOR 1
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 2
#define CLIENT_VERSION_BUILD 0
#define CLIENT_VERSION_BUILD 2

// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
Expand Down
6 changes: 6 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "masternodeman.h"
#include "masternodeconfig.h"
#include "spork.h"
#include "smessage.h"

#ifdef ENABLE_WALLET
#include "db.h"
Expand Down Expand Up @@ -114,6 +115,7 @@ void Shutdown()
RenameThread("DigitalNote-shutoff");
mempool.AddTransactionsUpdated(1);
StopRPCThreads();
SecureMsgShutdown();

#ifdef ENABLE_WALLET
ShutdownRPCMining();
Expand Down Expand Up @@ -983,6 +985,10 @@ bool AppInit2(boost::thread_group& threadGroup)
LogPrintf("Loaded %i addresses from peers.dat %dms\n",
addrman.size(), GetTimeMillis() - nStart);

// ********************************************************* Step 10.5: startup secure messaging

SecureMsgStart(fNoSmsg, GetBoolArg("-smsgscanchain", false));

// ********************************************************* Step 11: start node

if (!CheckDiskSpace())
Expand Down
11 changes: 11 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "masternodeman.h"
#include "masternode-payments.h"
#include "spork.h"
#include "smessage.h"
#include "util.h"

#include <boost/algorithm/string/replace.hpp>
Expand Down Expand Up @@ -4261,6 +4262,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)

ProcessBlock(pfrom, &block);
if (block.nDoS) Misbehaving(pfrom->GetId(), block.nDoS);
if (fSecMsgEnabled) {
SecureMsgScanBlock(block);
}
}

// This asymmetric behavior for inbound and outbound connections was introduced
Expand Down Expand Up @@ -4411,6 +4415,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)

else
{
if (fSecMsgEnabled) {
SecureMsgReceiveData(pfrom, strCommand, vRecv);
}
mnodeman.ProcessMessage(pfrom, strCommand, vRecv);
ProcessMessageMasternodePayments(pfrom, strCommand, vRecv);
ProcessMessageInstantX(pfrom, strCommand, vRecv);
Expand Down Expand Up @@ -4809,6 +4816,10 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
if (!vGetData.empty())
pto->PushMessage("getdata", vGetData);

if (fSecMsgEnabled) {
SecureMsgSendData(pto, fSendTrickle); // should be in cs_main?
}

}
return true;
}
1 change: 1 addition & 0 deletions src/makefile.unix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ LIBS += \
-l boost_filesystem$(BOOST_LIB_SUFFIX) \
-l boost_program_options$(BOOST_LIB_SUFFIX) \
-l boost_thread$(BOOST_LIB_SUFFIX) \
-l boost_chrono$(BOOST_LIB_SUFFIX) \
-l db_cxx$(BDB_LIB_SUFFIX) \
-l ssl \
-l gmp \
Expand Down
8 changes: 4 additions & 4 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#endif

#ifdef USE_UPNP
#include <miniupnpc-1.9/miniupnpc.h>
#include <miniupnpc-1.9/miniwget.h>
#include <miniupnpc-1.9/upnpcommands.h>
#include <miniupnpc-1.9/upnperrors.h>
#include <miniupnpc-2.1/miniupnpc.h>
#include <miniupnpc-2.1/miniwget.h>
#include <miniupnpc-2.1/upnpcommands.h>
#include <miniupnpc-2.1/upnperrors.h>
#endif

#include <boost/filesystem.hpp>
Expand Down
29 changes: 29 additions & 0 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,32 @@ class CBanEntry

typedef std::map<CSubNet, CBanEntry> banmap_t;

/** Information about a DigitalNote (D-Note) peer */
class SecMsgNode
{
public:
SecMsgNode()
{
lastSeen = 0;
lastMatched = 0;
ignoreUntil = 0;
nWakeCounter = 0;
nPeerId = 0;
fEnabled = false;
}

~SecMsgNode() {}

CCriticalSection cs_smsg_net;
int64_t lastSeen;
int64_t lastMatched;
int64_t ignoreUntil;
uint32_t nWakeCounter;
uint32_t nPeerId;
bool fEnabled;

};

/** Information about a peer */
class CNode
{
Expand Down Expand Up @@ -364,6 +390,9 @@ class CNode
std::set<uint256> setAskFor;
std::multimap<int64_t, CInv> mapAskFor;

// D-Note relay
SecMsgNode smsgData;

// Ping time measurement:
// The pong reply we're expecting, or 0 if no pong expected.
uint64_t nPingNonceSent;
Expand Down
72 changes: 72 additions & 0 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include "init.h"
#include "ui_interface.h"
#include "masternodemanager.h"
#include "messagemodel.h"
#include "messagepage.h"
#include "blockbrowser.h"
#include "importprivatekeydialog.h"

Expand Down Expand Up @@ -143,6 +145,8 @@ DigitalNoteGUI::DigitalNoteGUI(QWidget *parent):

masternodeManagerPage = new MasternodeManager(this);

messagePage = new MessagePage(this);

centralStackedWidget = new QStackedWidget(this);
centralStackedWidget->setContentsMargins(0, 0, 0, 0);
centralStackedWidget->addWidget(overviewPage);
Expand All @@ -151,6 +155,7 @@ DigitalNoteGUI::DigitalNoteGUI(QWidget *parent):
centralStackedWidget->addWidget(receiveCoinsPage);
centralStackedWidget->addWidget(sendCoinsPage);
centralStackedWidget->addWidget(masternodeManagerPage);
centralStackedWidget->addWidget(messagePage);
centralStackedWidget->addWidget(blockBrowser);

QWidget *centralWidget = new QWidget();
Expand Down Expand Up @@ -308,6 +313,12 @@ void DigitalNoteGUI::createActions()
masternodeManagerAction->setCheckable(true);
tabGroup->addAction(masternodeManagerAction);

messageAction = new QAction(QIcon(":/icons/edit"), tr("&Messages"), this);
messageAction->setToolTip(tr("View and Send Encrypted messages"));
messageAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_7));
messageAction->setCheckable(true);
tabGroup->addAction(messageAction);

blockAction = new QAction(QIcon(":/icons/block"), tr("&Block Explorer"), this);
blockAction->setToolTip(tr("Explore the BlockChain"));
blockAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6));
Expand All @@ -330,6 +341,8 @@ void DigitalNoteGUI::createActions()
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
connect(masternodeManagerAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(masternodeManagerAction, SIGNAL(triggered()), this, SLOT(gotoMasternodeManagerPage()));
connect(messageAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(messageAction, SIGNAL(triggered()), this, SLOT(gotoMessagePage()));

quitAction = new QAction(QIcon(":icons/quit"), tr("E&xit"), this);
quitAction->setToolTip(tr("Quit application"));
Expand Down Expand Up @@ -465,6 +478,9 @@ void DigitalNoteGUI::createToolBars()
toolbar->addAction(historyAction);
toolbar->addAction(addressBookAction);
toolbar->addAction(masternodeManagerAction);
if (!fLiteMode){
toolbar->addAction(messageAction);
}
toolbar->addAction(blockAction);
netLabel = new QLabel();

Expand Down Expand Up @@ -566,6 +582,23 @@ void DigitalNoteGUI::setWalletModel(WalletModel *walletModel)
}
}

void DigitalNoteGUI::setMessageModel(MessageModel *messageModel)
{
this->messageModel = messageModel;
if(messageModel)
{
// Report errors from message thread
connect(messageModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));

// Put transaction list in tabs
messagePage->setModel(messageModel);

// Balloon pop-up for new message
connect(messageModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(incomingMessage(QModelIndex,int,int)));
}
}

void DigitalNoteGUI::createTrayIcon()
{
QMenu *trayIconMenu;
Expand Down Expand Up @@ -869,6 +902,35 @@ void DigitalNoteGUI::incomingTransaction(const QModelIndex & parent, int start,
.arg(address), icon);
}

void DigitalNoteGUI::incomingMessage(const QModelIndex & parent, int start, int end)
{
if(!messageModel)
return;

MessageModel *mm = messageModel;

if (mm->index(start, MessageModel::TypeInt, parent).data().toInt() == MessageTableEntry::Received)
{
QString sent_datetime = mm->index(start, MessageModel::ReceivedDateTime, parent).data().toString();
QString from_address = mm->index(start, MessageModel::FromAddress, parent).data().toString();
QString to_address = mm->index(start, MessageModel::ToAddress, parent).data().toString();
QString message = mm->index(start, MessageModel::Message, parent).data().toString();
QTextDocument html;
html.setHtml(message);
QString messageText(html.toPlainText());
notificator->notify(Notificator::Information,
tr("Incoming Message"),
tr("Date: %1\n"
"From Address: %2\n"
"To Address: %3\n"
"Message: %4\n")
.arg(sent_datetime)
.arg(from_address)
.arg(to_address)
.arg(messageText));
};
}

void DigitalNoteGUI::clearWidgets()
{
centralStackedWidget->setCurrentWidget(centralStackedWidget->widget(0));
Expand Down Expand Up @@ -963,6 +1025,16 @@ void DigitalNoteGUI::gotoVerifyMessageTab(QString addr)
signVerifyMessageDialog->setAddress_VM(addr);
}

void DigitalNoteGUI::gotoMessagePage()
{
messageAction->setChecked(true);
centralStackedWidget->setCurrentWidget(messagePage);

exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), messagePage, SLOT(exportClicked()));
}

void DigitalNoteGUI::dragEnterEvent(QDragEnterEvent *event)
{
// Accept only URIs
Expand Down
Loading