Skip to content

Commit

Permalink
Added initial logs for all DAPI calls
Browse files Browse the repository at this point in the history
  • Loading branch information
EDDragonWolf committed Feb 13, 2018
1 parent 8f3e18c commit 0e1421f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/supernode/PosProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ void supernode::PosProxy::Init() {


bool supernode::PosProxy::Sale(const rpc_command::POS_SALE::request& in, rpc_command::POS_SALE::response& out) {
LOG_PRINT_L0("PosProxy::Sale" << in.POSAddress << in.Amount);
//TODO: Add input data validation
boost::shared_ptr<PosSaleObject> data = boost::shared_ptr<PosSaleObject>( new PosSaleObject() );
data->Owner(this);
Expand All @@ -48,7 +49,7 @@ bool supernode::PosProxy::Sale(const rpc_command::POS_SALE::request& in, rpc_com
if (!data->Init(in))
{
out.Result = ERROR_SALE_REQUEST_FAILED;
LOG_PRINT_L5("ERROR_SALE_REQUEST_FAILED");
LOG_PRINT_L0("ERROR_SALE_REQUEST_FAILED");
return false;
}
Add(data);
Expand Down
4 changes: 4 additions & 0 deletions src/supernode/PosSaleObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,22 @@ void supernode::PosSaleObject::ContinueInit() {
}

bool supernode::PosSaleObject::AuthWalletRejectPay(const rpc_command::WALLET_REJECT_PAY::request &in, rpc_command::WALLET_REJECT_PAY::response &out) {
LOG_PRINT_L0("PosSaleObject::AuthWalletRejectPay" << in.PaymentID);
m_Status = NTransactionStatus::RejectedByWallet;
return true;
}

bool supernode::PosSaleObject::GetSaleStatus(const rpc_command::POS_GET_SALE_STATUS::request& in, rpc_command::POS_GET_SALE_STATUS::response& out)
{
LOG_PRINT_L0("PosSaleObject::GetSaleStatus" << in.PaymentID);
out.Status = int(m_Status);
out.Result = STATUS_OK;
return true;
}


bool supernode::PosSaleObject::PoSTRSigned(const rpc_command::POS_TR_SIGNED::request& in, rpc_command::POS_TR_SIGNED::response& out) {
LOG_PRINT_L0("PosSaleObject::PoSTRSigned" << in.PaymentID);
{
boost::lock_guard<boost::recursive_mutex> lock(m_TxInPoolGotGuard);
if(m_TxInPoolGot) return true;
Expand Down Expand Up @@ -252,6 +255,7 @@ bool supernode::PosSaleObject::PoSTRSigned(const rpc_command::POS_TR_SIGNED::req


bool supernode::PosSaleObject::PosRejectSale(const supernode::rpc_command::POS_REJECT_SALE::request &in, supernode::rpc_command::POS_REJECT_SALE::response &out) {
LOG_PRINT_L0("PosSaleObject::PosRejectSale" << in.PaymentID);
m_Status = NTransactionStatus::RejectedByPOS;

//TODO: Add impl
Expand Down
1 change: 1 addition & 0 deletions src/supernode/WalletPayObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ bool supernode::WalletPayObject::_Init(const rpc_command::WALLET_PAY::request& s
}

bool supernode::WalletPayObject::GetPayStatus(const rpc_command::WALLET_GET_TRANSACTION_STATUS::request& in, rpc_command::WALLET_GET_TRANSACTION_STATUS::response& out) {
LOG_PRINT_L0("WalletPayObject::GetPayStatus" << in.PaymentID);
out.Status = int(m_Status);
//TimeMark -= boost::posix_time::hours(3);
out.Result = STATUS_OK;
Expand Down
4 changes: 3 additions & 1 deletion src/supernode/WalletProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void supernode::WalletProxy::Init() {

bool supernode::WalletProxy::WalletRejectPay(const rpc_command::WALLET_REJECT_PAY::request &in, rpc_command::WALLET_REJECT_PAY::response &out) {
// TODO: if have PayID, don't call

LOG_PRINT_L0("WalletProxy::WalletRejectPay" << in.PaymentID);
SubNetBroadcast sub;
sub.Set( m_DAPIServer, in.PaymentID, m_Servant->GetAuthSample(in.BlockNum) );
vector<rpc_command::WALLET_REJECT_PAY::response> vout;
Expand All @@ -51,6 +51,7 @@ bool supernode::WalletProxy::WalletRejectPay(const rpc_command::WALLET_REJECT_PA


bool supernode::WalletProxy::Pay(const rpc_command::WALLET_PAY::request& in, rpc_command::WALLET_PAY::response& out) {
LOG_PRINT_L0("WalletProxy::Pay" << in.POSAddress << in.Amount);
boost::shared_ptr<WalletPayObject> data = boost::shared_ptr<WalletPayObject>( new WalletPayObject() );
data->Owner(this);
Setup(data);
Expand All @@ -68,6 +69,7 @@ bool supernode::WalletProxy::Pay(const rpc_command::WALLET_PAY::request& in, rpc
}

bool supernode::WalletProxy::WalletGetPosData(const rpc_command::WALLET_GET_POS_DATA::request& in, rpc_command::WALLET_GET_POS_DATA::response& out) {
LOG_PRINT_L0("WalletProxy::WalletGetPosData" << in.PaymentID);
// we allready have block num
vector< boost::shared_ptr<FSN_Data> > vv = m_Servant->GetAuthSample( in.BlockNum );
if( vv.size()!=m_Servant->AuthSampleSize() ) return false;
Expand Down
4 changes: 4 additions & 0 deletions src/supernode/baseclientproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ void supernode::BaseClientProxy::Init()

bool supernode::BaseClientProxy::GetWalletBalance(const supernode::rpc_command::GET_WALLET_BALANCE::request &in, supernode::rpc_command::GET_WALLET_BALANCE::response &out)
{
LOG_PRINT_L0("BaseClientProxy::GetWalletBalance" << in.Account);
std::unique_ptr<tools::GraftWallet> wal = initWallet(base64_decode(in.Account), in.Password);
if (!wal)
{
Expand All @@ -73,6 +74,7 @@ bool supernode::BaseClientProxy::GetWalletBalance(const supernode::rpc_command::

bool supernode::BaseClientProxy::CreateAccount(const supernode::rpc_command::CREATE_ACCOUNT::request &in, supernode::rpc_command::CREATE_ACCOUNT::response &out)
{
LOG_PRINT_L0("BaseClientProxy::CreateAccount" << in.Language);
std::vector<std::string> languages;
crypto::ElectrumWords::get_language_list(languages);
std::vector<std::string>::iterator it;
Expand Down Expand Up @@ -115,6 +117,7 @@ bool supernode::BaseClientProxy::CreateAccount(const supernode::rpc_command::CRE

bool supernode::BaseClientProxy::GetSeed(const supernode::rpc_command::GET_SEED::request &in, supernode::rpc_command::GET_SEED::response &out)
{
LOG_PRINT_L0("BaseClientProxy::GetSeed" << in.Account);
std::unique_ptr<tools::GraftWallet> wal = initWallet(base64_decode(in.Account), in.Password);
if (!wal)
{
Expand All @@ -131,6 +134,7 @@ bool supernode::BaseClientProxy::GetSeed(const supernode::rpc_command::GET_SEED:

bool supernode::BaseClientProxy::RestoreAccount(const supernode::rpc_command::RESTORE_ACCOUNT::request &in, supernode::rpc_command::RESTORE_ACCOUNT::response &out)
{
LOG_PRINT_L0("BaseClientProxy::RestoreAccount" << in.Seed);
if (in.Seed.empty())
{
out.Result = ERROR_ELECTRUM_SEED_EMPTY;
Expand Down
2 changes: 1 addition & 1 deletion src/supernode/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace supernode {

int main(int argc, const char** argv) {
mlog_configure("", true);
mlog_set_log_level(5);
mlog_set_log_level(0);

string conf_file("conf.ini");
if(argc>1) conf_file = argv[1];
Expand Down

0 comments on commit 0e1421f

Please sign in to comment.