Browse Source

NSPV_AUTOLOGOUT

warmup
jl777 5 years ago
parent
commit
f87d54f961
  1. 10
      src/komodo_nSPV_wallet.h
  2. 4
      src/wallet/rpcdump.cpp

10
src/komodo_nSPV_wallet.h

@ -19,7 +19,7 @@
// nSPV wallet uses superlite functions (and some komodod built in functions) to implement nSPV_send
// interest calculations are currently just using what is returned, it should calculate it from scratch
#define NSPV_AUTOLOGOUT 60
#define NSPV_BRANCHID 0x76b809bb
int32_t NSPV_gettransaction(uint256 txid,int32_t height,CTransaction &tx)
@ -213,6 +213,12 @@ std::string NSPV_signtx(CMutableTransaction &mtx,uint64_t txfee,CScript opret,st
UniValue NSPV_send(char *srcaddr,char *destaddr,int64_t satoshis) // what its all about!
{
UniValue result(UniValue::VOBJ); uint8_t rmd160[128]; int64_t txfee = 10000;
if ( NSPV_logintime == 0 || time(NULL) > NSPV_logintime+NSPV_AUTOLOGOUT )
{
result.push_back(Pair("result","error"));
result.push_back(Pair("error","wif expired"));
return(result);
}
if ( strcmp(srcaddr,NSPV_address.c_str()) != 0 )
{
result.push_back(Pair("result","error"));
@ -289,7 +295,7 @@ UniValue NSPV_send(char *srcaddr,char *destaddr,int64_t satoshis) // what its al
void komodo_nSPV(CNode *pto) // polling loop from SendMessages
{
uint8_t msg[256]; int32_t i,len=0; uint32_t timestamp = (uint32_t)time(NULL);
if ( NSPV_logintime != 0 && timestamp > NSPV_logintime+60 )
if ( NSPV_logintime != 0 && timestamp > NSPV_logintime+NSPV_AUTOLOGOUT )
{
fprintf(stderr,"scrub wif from NSPV memory\n");
memset(NSPV_wifstr,0,sizeof(NSPV_wifstr));

4
src/wallet/rpcdump.cpp

@ -999,10 +999,10 @@ UniValue nspv_login(const UniValue& params, bool fHelp)
UniValue nspv_listunspent(const UniValue& params, bool fHelp)
{
if ( fHelp || params.size() > 1 )
throw runtime_error("nspv_listunspent address\n");
if ( params.size() == 0 && NSPV_address.size() != 0 )
return(NSPV_addressutxos((char *)NSPV_address.c_str()));
if ( fHelp || params.size() != 1 )
throw runtime_error("nspv_listunspent address\n");
return(NSPV_addressutxos((char *)params[0].get_str().c_str()));
}

Loading…
Cancel
Save