+getinfo fields

This commit is contained in:
jl777
2019-07-06 09:56:25 -11:00
parent 1d4be8defb
commit 6e730ec150
4 changed files with 23 additions and 11 deletions

View File

@@ -16,13 +16,24 @@
// todo:
// make sure no files are updated (this is to allow nSPV=1 and later nSPV=0 without affecting database)
// determine if it makes sense to be scanning mempool for the utxo/spentinfo requests, maybe can add isspent flag to txproof, or just use getspentinfo if broadcast fails
// validate proofs
// interest calculations are currently just using what is returned, it should calculate it from scratch
// need to validate incoming data and update only if it is valid and more recent
// make sure to sanity check all vector lengths on receipt
// determine if it makes sense to be scanning mempool for the utxo/spentinfo requests
#ifndef KOMODO_NSPV_H
#define KOMODO_NSPV_H
#define NSPV_POLLITERS 15
#define NSPV_POLLMICROS 100000
#define NSPV_MAXVINS 64
#define NSPV_AUTOLOGOUT 777
#define NSPV_BRANCHID 0x76b809bb
// nSPV defines and struct definitions with serialization and purge functions
#define NSPV_INFO 0x00

View File

@@ -17,7 +17,6 @@
#ifndef KOMODO_NSPVFULLNODE_H
#define KOMODO_NSPVFULLNODE_H
// on fullnode:
// NSPV_get... functions need to return the exact serialized length, which is the size of the structure minus size of pointers, plus size of allocated data
#include "notarisationdb.h"

View File

@@ -21,12 +21,6 @@
// no caching, no optimizations, no reducing the number of ntzsproofs needed by detecting overlaps, etc.
// advantage is that it is simpler to implement and understand to create a design for a more performant version
// interest calculations are currently just using what is returned, it should calculate it from scratch
// need to validate incoming data and update only if it is valid and more recent
#define NSPV_POLLITERS 15
#define NSPV_POLLMICROS 100000
#define NSPV_MAXVINS 64
CAmount AmountFromValue(const UniValue& value);
int32_t bitcoin_base58decode(uint8_t *data,char *coinaddr);
@@ -113,8 +107,18 @@ UniValue NSPV_ntz_json(struct NSPV_ntz *ptr)
UniValue _NSPV_getinfo_json(struct NSPV_inforesp *ptr)
{
UniValue result(UniValue::VOBJ);
UniValue result(UniValue::VOBJ); int32_t expiration; uint32_t timestamp = (uint32_t)time(NULL);
result.push_back(Pair("result","success"));
if ( NSPV_address.size() != 0 )
{
result.push_back(Pair("address",NSPV_address));
result.push_back(Pair("pubkey",NSPV_pubkeystr));
}
if ( NSPV_logintime != 0 )
{
expiration = (NSPV_logintime + NSPV_AUTOLOGOUT - timestamp);
result.push_back(Pair("wifexpires",expiration));
}
result.push_back(Pair("height",(int64_t)ptr->height));
result.push_back(Pair("chaintip",ptr->blockhash.GetHex()));
result.push_back(Pair("notarization",NSPV_ntz_json(&ptr->notarization)));

View File

@@ -20,8 +20,6 @@
// nSPV wallet uses superlite functions (and some komodod built in functions) to implement nSPV_spend
extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry);
#define NSPV_AUTOLOGOUT 777
#define NSPV_BRANCHID 0x76b809bb
/*struct NSPV_ntzproofshared