Skip to content

Commit

Permalink
functions for news rpcs added
Browse files Browse the repository at this point in the history
  • Loading branch information
santos177 committed Mar 5, 2019
1 parent 6d951f2 commit f729b0c
Show file tree
Hide file tree
Showing 11 changed files with 1,380 additions and 1,052 deletions.
Binary file renamed src/test/test_bitcoin_fuzzy → src/bitcoin-tx
Binary file not shown.
2 changes: 1 addition & 1 deletion src/bitcoind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ bool AppInit(int argc, char* argv[])
if (gArgs.GetBoolArg("-daemon", false))
{
#if HAVE_DECL_DAEMON
fprintf(stdout, "BitcoinGold server starting\n");
fprintf(stdout, "OmniCore Gold server starting\n");

// Daemonize
if (daemon(1, 0)) { // don't chdir (1), do close FDs (0)
Expand Down
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,7 @@ bool AppInitParameterInteraction()
RegisterAllCoreRPCCommands(tableRPC);
#ifdef ENABLE_WALLET
RegisterWalletRPCCommands(tableRPC);
RegisterOmniTransactionCreationRPCCommands(tableRPC);
#endif

nConnectTimeout = gArgs.GetArg("-timeout", DEFAULT_CONNECT_TIMEOUT);
Expand Down
2,105 changes: 1,083 additions & 1,022 deletions src/omnicore/.deps/libbitcoin_server_a-rpctx.Po

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/omnicore/omnicore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2219,8 +2219,8 @@ int mastercore_init()
// // nothing to do
// return 0;
// }

// PrintToConsole("Initializing Omni Core v%s [%s]\n", OmniCoreVersion(), Params().NetworkIDString());
PrintToConsole("Initializing Omni Core Gold\n");
// PrintToConsole("Initializing Omni Core v%s [%s]\n", OmniCoreVersion(), Params().NetworkIDString());
//
// PrintToLog("\nInitializing Omni Core v%s [%s]\n", OmniCoreVersion(), Params().NetworkIDString());
// PrintToLog("Startup time: %s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()));
Expand Down Expand Up @@ -2341,7 +2341,7 @@ int mastercore_init()
// }
//
// // initial scan
// msc_initial_scan(nWaterlineBlock);
// msc_initial_scan(nWaterlineBlock);
//
// // display Exodus balance
// int64_t exodus_balance = getMPbalance(exodus_address, OMNI_PROPERTY_MSC, BALANCE);
Expand Down
11 changes: 7 additions & 4 deletions src/omnicore/rpctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
// #include "omnicore/sp.h"
// #include "omnicore/tx.h"

#include "wallet/coincontrol.h"
#include "consensus/validation.h"
#include "init.h"
// #include "main.h"
#include "net.h"
#include "rpc/server.h"
#include "sync.h"
#include "utilmoneystr.h"
#ifdef ENABLE_WALLET
#include "wallet/wallet.h"
#endif
Expand Down Expand Up @@ -116,7 +119,7 @@ UniValue omni_send(const JSONRPCRequest& request)
// std::vector<unsigned char> payload = CreatePayload_SimpleSend(propertyId, amount);
//
// // request the wallet build the transaction (and if needed commit it)
// uint256 txid;
uint256 txid;
// std::string rawHex;
// int result = WalletTxBuilder(fromAddress, toAddress, redeemAddress, referenceAmount, payload, txid, rawHex, autoCommit);
//
Expand All @@ -128,7 +131,7 @@ UniValue omni_send(const JSONRPCRequest& request)
// return rawHex;
// } else {
// PendingAdd(txid, fromAddress, MSC_TYPE_SIMPLE_SEND, propertyId, amount);
// return txid.GetHex();
return txid.GetHex();
// }
// }
}
Expand Down Expand Up @@ -1443,7 +1446,7 @@ static const CRPCCommand commands[] =
// ------------------------------------ ------------------------------- ------------------------------ ----------
#ifdef ENABLE_WALLET
// { "omni layer (transaction creation)", "omni_sendrawtx", &omni_sendrawtx, false },
{ "omni layer (transaction creation)", "omni_send", &omni_send, false },
{ "omni layer (transaction creation)", "omni_send", &omni_send, true, {} },
// { "omni layer (transaction creation)", "omni_senddexsell", &omni_senddexsell, false },
// { "omni layer (transaction creation)", "omni_senddexaccept", &omni_senddexaccept, false },
// { "omni layer (transaction creation)", "omni_sendissuancecrowdsale", &omni_sendissuancecrowdsale, false },
Expand Down
44 changes: 24 additions & 20 deletions src/omnicore/rpctx.h
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
#ifndef OMNICORE_RPCTX
#define OMNICORE_RPCTX



#include "rpc/server.h"
#include "wallet/wallet.h"
#include <univalue.h>

UniValue omni_sendrawtx(const UniValue& params, bool fHelp);
UniValue omni_send(const UniValue& params, bool fHelp);
UniValue omni_sendall(const UniValue& params, bool fHelp);
UniValue omni_senddexsell(const UniValue& params, bool fHelp);
UniValue omni_senddexaccept(const UniValue& params, bool fHelp);
UniValue omni_sendissuancecrowdsale(const UniValue& params, bool fHelp);
UniValue omni_sendissuancefixed(const UniValue& params, bool fHelp);
UniValue omni_sendissuancemanaged(const UniValue& params, bool fHelp);
UniValue omni_sendsto(const UniValue& params, bool fHelp);
UniValue omni_sendgrant(const UniValue& params, bool fHelp);
UniValue omni_sendrevoke(const UniValue& params, bool fHelp);
UniValue omni_sendclosecrowdsale(const UniValue& params, bool fHelp);
UniValue trade_MP(const UniValue& params, bool fHelp);
UniValue omni_sendtrade(const UniValue& params, bool fHelp);
UniValue omni_sendcanceltradesbyprice(const UniValue& params, bool fHelp);
UniValue omni_sendcanceltradesbypair(const UniValue& params, bool fHelp);
UniValue omni_sendcancelalltrades(const UniValue& params, bool fHelp);
UniValue omni_sendchangeissuer(const UniValue& params, bool fHelp);
UniValue omni_sendactivation(const UniValue& params, bool fHelp);
UniValue omni_sendalert(const UniValue& params, bool fHelp);
// UniValue omni_sendrawtx(const UniValue& params, bool fHelp);
UniValue omni_send(const JSONRPCRequest& request);
// UniValue omni_sendall(const UniValue& params, bool fHelp);
// UniValue omni_senddexsell(const UniValue& params, bool fHelp);
// UniValue omni_senddexaccept(const UniValue& params, bool fHelp);
// UniValue omni_sendissuancecrowdsale(const UniValue& params, bool fHelp);
// UniValue omni_sendissuancefixed(const UniValue& params, bool fHelp);
// UniValue omni_sendissuancemanaged(const UniValue& params, bool fHelp);
// UniValue omni_sendsto(const UniValue& params, bool fHelp);
// UniValue omni_sendgrant(const UniValue& params, bool fHelp);
// UniValue omni_sendrevoke(const UniValue& params, bool fHelp);
// UniValue omni_sendclosecrowdsale(const UniValue& params, bool fHelp);
// UniValue trade_MP(const UniValue& params, bool fHelp);
// UniValue omni_sendtrade(const UniValue& params, bool fHelp);
// UniValue omni_sendcanceltradesbyprice(const UniValue& params, bool fHelp);
// UniValue omni_sendcanceltradesbypair(const UniValue& params, bool fHelp);
// UniValue omni_sendcancelalltrades(const UniValue& params, bool fHelp);
// UniValue omni_sendchangeissuer(const UniValue& params, bool fHelp);
// UniValue omni_sendactivation(const UniValue& params, bool fHelp);
// UniValue omni_sendalert(const UniValue& params, bool fHelp);

#endif // OMNICORE_RPCTX
239 changes: 239 additions & 0 deletions src/qt/bitcoin.moc
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
/****************************************************************************
** Meta object code from reading C++ file 'bitcoin.cpp'
**
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'bitcoin.cpp' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.7. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif

QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_BitcoinCore[] = {

// content:
6, // revision
0, // classname
0, 0, // classinfo
5, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
3, // signalCount

// signals: signature, parameters, type, tag, flags
21, 13, 12, 12, 0x05,
44, 12, 12, 12, 0x05,
69, 61, 12, 12, 0x05,

// slots: signature, parameters, type, tag, flags
95, 12, 12, 12, 0x0a,
108, 12, 12, 12, 0x0a,

0 // eod
};

static const char qt_meta_stringdata_BitcoinCore[] = {
"BitcoinCore\0\0success\0initializeResult(bool)\0"
"shutdownResult()\0message\0"
"runawayException(QString)\0initialize()\0"
"shutdown()\0"
};

void BitcoinCore::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
BitcoinCore *_t = static_cast<BitcoinCore *>(_o);
switch (_id) {
case 0: _t->initializeResult((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 1: _t->shutdownResult(); break;
case 2: _t->runawayException((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 3: _t->initialize(); break;
case 4: _t->shutdown(); break;
default: ;
}
}
}

const QMetaObjectExtraData BitcoinCore::staticMetaObjectExtraData = {
0, qt_static_metacall
};

const QMetaObject BitcoinCore::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_BitcoinCore,
qt_meta_data_BitcoinCore, &staticMetaObjectExtraData }
};

#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &BitcoinCore::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION

const QMetaObject *BitcoinCore::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}

void *BitcoinCore::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_BitcoinCore))
return static_cast<void*>(const_cast< BitcoinCore*>(this));
return QObject::qt_metacast(_clname);
}

int BitcoinCore::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 5)
qt_static_metacall(this, _c, _id, _a);
_id -= 5;
}
return _id;
}

// SIGNAL 0
void BitcoinCore::initializeResult(bool _t1)
{
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}

// SIGNAL 1
void BitcoinCore::shutdownResult()
{
QMetaObject::activate(this, &staticMetaObject, 1, 0);
}

// SIGNAL 2
void BitcoinCore::runawayException(const QString & _t1)
{
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 2, _a);
}
static const uint qt_meta_data_BitcoinApplication[] = {

// content:
6, // revision
0, // classname
0, 0, // classinfo
7, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
4, // signalCount

// signals: signature, parameters, type, tag, flags
20, 19, 19, 19, 0x05,
42, 19, 19, 19, 0x05,
62, 19, 19, 19, 0x05,
82, 75, 19, 19, 0x05,

// slots: signature, parameters, type, tag, flags
115, 107, 19, 19, 0x0a,
138, 19, 19, 19, 0x0a,
163, 155, 19, 19, 0x0a,

0 // eod
};

static const char qt_meta_stringdata_BitcoinApplication[] = {
"BitcoinApplication\0\0requestedInitialize()\0"
"requestedShutdown()\0stopThread()\0"
"window\0splashFinished(QWidget*)\0success\0"
"initializeResult(bool)\0shutdownResult()\0"
"message\0handleRunawayException(QString)\0"
};

void BitcoinApplication::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
BitcoinApplication *_t = static_cast<BitcoinApplication *>(_o);
switch (_id) {
case 0: _t->requestedInitialize(); break;
case 1: _t->requestedShutdown(); break;
case 2: _t->stopThread(); break;
case 3: _t->splashFinished((*reinterpret_cast< QWidget*(*)>(_a[1]))); break;
case 4: _t->initializeResult((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 5: _t->shutdownResult(); break;
case 6: _t->handleRunawayException((*reinterpret_cast< const QString(*)>(_a[1]))); break;
default: ;
}
}
}

const QMetaObjectExtraData BitcoinApplication::staticMetaObjectExtraData = {
0, qt_static_metacall
};

const QMetaObject BitcoinApplication::staticMetaObject = {
{ &QApplication::staticMetaObject, qt_meta_stringdata_BitcoinApplication,
qt_meta_data_BitcoinApplication, &staticMetaObjectExtraData }
};

#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &BitcoinApplication::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION

const QMetaObject *BitcoinApplication::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}

void *BitcoinApplication::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_BitcoinApplication))
return static_cast<void*>(const_cast< BitcoinApplication*>(this));
return QApplication::qt_metacast(_clname);
}

int BitcoinApplication::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QApplication::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 7)
qt_static_metacall(this, _c, _id, _a);
_id -= 7;
}
return _id;
}

// SIGNAL 0
void BitcoinApplication::requestedInitialize()
{
QMetaObject::activate(this, &staticMetaObject, 0, 0);
}

// SIGNAL 1
void BitcoinApplication::requestedShutdown()
{
QMetaObject::activate(this, &staticMetaObject, 1, 0);
}

// SIGNAL 2
void BitcoinApplication::stopThread()
{
QMetaObject::activate(this, &staticMetaObject, 2, 0);
}

// SIGNAL 3
void BitcoinApplication::splashFinished(QWidget * _t1)
{
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 3, _a);
}
QT_END_MOC_NAMESPACE
5 changes: 5 additions & 0 deletions src/rpc/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "rpc/protocol.h"
#include "util.h"

#include <cstdint>

#include <set>
#include <stdint.h>

Expand Down Expand Up @@ -143,6 +145,9 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "echojson", 7, "arg7" },
{ "echojson", 8, "arg8" },
{ "echojson", 9, "arg9" },

/* Omni Core - transaction calls */
{ "omni_send", 2, "" },
};

class CRPCConvertTable
Expand Down
Loading

0 comments on commit f729b0c

Please sign in to comment.