geterablockheights RPC
This commit is contained in:
@@ -1111,8 +1111,9 @@ bool ContextualCheckTransaction(
|
|||||||
if (IsExpiredTx(tx, nHeight)) {
|
if (IsExpiredTx(tx, nHeight)) {
|
||||||
// Don't increase banscore if the transaction only just expired
|
// Don't increase banscore if the transaction only just expired
|
||||||
int expiredDosLevel = IsExpiredTx(tx, nHeight - 1) ? (dosLevel > 10 ? dosLevel : 10) : 0;
|
int expiredDosLevel = IsExpiredTx(tx, nHeight - 1) ? (dosLevel > 10 ? dosLevel : 10) : 0;
|
||||||
|
string strHex = EncodeHexTx(tx);
|
||||||
return state.DoS(expiredDosLevel, error("ContextualCheckTransaction(): transaction %s is expired, expiry block %i vs current block %i",tx.GetHash().ToString(),tx.nExpiryHeight,nHeight), REJECT_INVALID, "tx-overwinter-expired");
|
//fprintf(stderr, "transaction exipred.%s\n",strHex.c_str());
|
||||||
|
return state.DoS(expiredDosLevel, error("ContextualCheckTransaction(): transaction %s is expired, expiry block %i vs current block %i\n txhex.%s",tx.GetHash().ToString(),tx.nExpiryHeight,nHeight,strHex), REJECT_INVALID, "tx-overwinter-expired");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,10 +86,10 @@ extern int32_t ASSETCHAINS_LWMAPOS,ASSETCHAINS_SAPLING,ASSETCHAINS_STAKED;
|
|||||||
extern uint64_t ASSETCHAINS_ENDSUBSIDY[],ASSETCHAINS_REWARD[],ASSETCHAINS_HALVING[],ASSETCHAINS_DECAY[],ASSETCHAINS_NOTARY_PAY[];
|
extern uint64_t ASSETCHAINS_ENDSUBSIDY[],ASSETCHAINS_REWARD[],ASSETCHAINS_HALVING[],ASSETCHAINS_DECAY[],ASSETCHAINS_NOTARY_PAY[];
|
||||||
extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern uint8_t NOTARY_PUBKEY33[];
|
extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern uint8_t NOTARY_PUBKEY33[];
|
||||||
|
|
||||||
int32_t getera(int now)
|
int32_t getera(int timestamp)
|
||||||
{
|
{
|
||||||
for (int32_t i = 0; i < NUM_STAKED_ERAS; i++) {
|
for (int32_t i = 0; i < NUM_STAKED_ERAS; i++) {
|
||||||
if ( now <= STAKED_NOTARIES_TIMESTAMP[i] ) {
|
if ( timestamp <= STAKED_NOTARIES_TIMESTAMP[i] ) {
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,6 +163,32 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UniValue geterablockheights(const UniValue& params, bool fHelp)
|
||||||
|
{
|
||||||
|
if (fHelp || params.size() != 0)
|
||||||
|
throw runtime_error(
|
||||||
|
"getnotarysendmany\n"
|
||||||
|
"Returns a JSON object with the first block in each era.\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
CBlockIndex *pindex; int8_t lastera,era = 0; UniValue ret(UniValue::VOBJ);
|
||||||
|
|
||||||
|
for (size_t i = 1; i < chainActive.LastTip()->GetHeight(); i++)
|
||||||
|
{
|
||||||
|
pindex = chainActive[i];
|
||||||
|
era = getera(pindex->nTime)+1;
|
||||||
|
if ( era > lastera )
|
||||||
|
{
|
||||||
|
char str[16];
|
||||||
|
sprintf(str, "%d", era);
|
||||||
|
ret.push_back(Pair(str,i));
|
||||||
|
lastera = era;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
UniValue getinfo(const UniValue& params, bool fHelp)
|
UniValue getinfo(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,kmdnotarized_height,txid_height;
|
uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,kmdnotarized_height,txid_height;
|
||||||
|
|||||||
@@ -293,6 +293,7 @@ static const CRPCCommand vRPCCommands[] =
|
|||||||
{ "control", "help", &help, true },
|
{ "control", "help", &help, true },
|
||||||
{ "control", "getiguanajson", &getiguanajson, true },
|
{ "control", "getiguanajson", &getiguanajson, true },
|
||||||
{ "control", "getnotarysendmany", &getnotarysendmany, true },
|
{ "control", "getnotarysendmany", &getnotarysendmany, true },
|
||||||
|
{ "control", "geterablockheights", &geterablockheights, true },
|
||||||
{ "control", "stop", &stop, true },
|
{ "control", "stop", &stop, true },
|
||||||
|
|
||||||
/* P2P networking */
|
/* P2P networking */
|
||||||
|
|||||||
@@ -381,6 +381,7 @@ extern UniValue decodeccopret(const UniValue& params, bool fHelp);
|
|||||||
extern UniValue getinfo(const UniValue& params, bool fHelp);
|
extern UniValue getinfo(const UniValue& params, bool fHelp);
|
||||||
extern UniValue getiguanajson(const UniValue& params, bool fHelp);
|
extern UniValue getiguanajson(const UniValue& params, bool fHelp);
|
||||||
extern UniValue getnotarysendmany(const UniValue& params, bool fHelp);
|
extern UniValue getnotarysendmany(const UniValue& params, bool fHelp);
|
||||||
|
extern UniValue geterablockheights(const UniValue& params, bool fHelp);
|
||||||
extern UniValue setpubkey(const UniValue& params, bool fHelp);
|
extern UniValue setpubkey(const UniValue& params, bool fHelp);
|
||||||
extern UniValue getwalletinfo(const UniValue& params, bool fHelp);
|
extern UniValue getwalletinfo(const UniValue& params, bool fHelp);
|
||||||
extern UniValue getblockchaininfo(const UniValue& params, bool fHelp);
|
extern UniValue getblockchaininfo(const UniValue& params, bool fHelp);
|
||||||
|
|||||||
Reference in New Issue
Block a user