Prevent signing when not logged in
This commit is contained in:
@@ -444,12 +444,19 @@ std::vector<uint8_t> Mypubkey()
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern char NSPV_wifstr[],NSPV_pubkeystr[];
|
extern char NSPV_wifstr[],NSPV_pubkeystr[];
|
||||||
|
extern uint32_t NSPV_logintime;
|
||||||
|
#define NSPV_AUTOLOGOUT 777
|
||||||
|
|
||||||
bool Myprivkey(uint8_t myprivkey[])
|
bool Myprivkey(uint8_t myprivkey[])
|
||||||
{
|
{
|
||||||
char coinaddr[64],checkaddr[64]; std::string strAddress; char *dest; int32_t i,n; CBitcoinAddress address; CKeyID keyID; CKey vchSecret; uint8_t buf33[33];
|
char coinaddr[64],checkaddr[64]; std::string strAddress; char *dest; int32_t i,n; CBitcoinAddress address; CKeyID keyID; CKey vchSecret; uint8_t buf33[33];
|
||||||
if ( KOMODO_NSPV != 0 )
|
if ( KOMODO_NSPV != 0 )
|
||||||
{
|
{
|
||||||
|
if ( NSPV_logintime == 0 || time(NULL) > NSPV_logintime+NSPV_AUTOLOGOUT )
|
||||||
|
{
|
||||||
|
fprintf(stderr,"need to be logged in to get myprivkey\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
vchSecret = DecodeSecret(NSPV_wifstr);
|
vchSecret = DecodeSecret(NSPV_wifstr);
|
||||||
memcpy(myprivkey,vchSecret.begin(),32);
|
memcpy(myprivkey,vchSecret.begin(),32);
|
||||||
//for (i=0; i<32; i++)
|
//for (i=0; i<32; i++)
|
||||||
|
|||||||
@@ -236,6 +236,11 @@ int64_t NSPV_addinputs(struct NSPV_utxoresp *used,CMutableTransaction &mtx,int64
|
|||||||
bool NSPV_SignTx(CMutableTransaction &mtx,int32_t vini,int64_t utxovalue,const CScript scriptPubKey,uint32_t nTime)
|
bool NSPV_SignTx(CMutableTransaction &mtx,int32_t vini,int64_t utxovalue,const CScript scriptPubKey,uint32_t nTime)
|
||||||
{
|
{
|
||||||
CTransaction txNewConst(mtx); SignatureData sigdata; CBasicKeyStore keystore; int64_t branchid = NSPV_BRANCHID;
|
CTransaction txNewConst(mtx); SignatureData sigdata; CBasicKeyStore keystore; int64_t branchid = NSPV_BRANCHID;
|
||||||
|
if ( NSPV_logintime == 0 || time(NULL) > NSPV_logintime+NSPV_AUTOLOGOUT )
|
||||||
|
{
|
||||||
|
fprintf(stderr,"need to be logged in to get myprivkey\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
keystore.AddKey(NSPV_key);
|
keystore.AddKey(NSPV_key);
|
||||||
if ( nTime != 0 && nTime < KOMODO_SAPLING_ACTIVATION )
|
if ( nTime != 0 && nTime < KOMODO_SAPLING_ACTIVATION )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user