Browse Source

add notary pay stuff without breaking blockindex.

pull/27/head
blackjok3r 5 years ago
parent
commit
25bf471ddd
  1. 13
      src/chain.h
  2. 4
      src/komodo_nk.h
  3. 4
      src/main.cpp

13
src/chain.h

@ -28,6 +28,7 @@ class CChainPower;
#include "pow.h"
#include "tinyformat.h"
#include "uint256.h"
extern int8_t is_STAKED(const char *chain_name);
#include <vector>
@ -36,6 +37,8 @@ class CChainPower;
static const int SPROUT_VALUE_VERSION = 1001400;
static const int SAPLING_VALUE_VERSION = 1010100;
extern int32_t ASSETCHAINS_LWMAPOS;
extern char ASSETCHAINS_SYMBOL[65];
//extern uint64_t ASSETCHAINS_NOTARY_PAY;
struct CDiskBlockPos
{
@ -532,11 +535,6 @@ public:
READWRITE(nBits);
READWRITE(nNonce);
READWRITE(nSolution);
// LABS extra blockindex stuff.
// only read/write nNotaryPay if it has a value. This should be backwards compatible with all existing chains.
if ( nNotaryPay != 0 )
READWRITE(nNotaryPay);
// Only read/write nSproutValue if the client version used to create
// this index was storing them.
@ -549,6 +547,11 @@ public:
if ((s.GetType() & SER_DISK) && (nVersion >= SAPLING_VALUE_VERSION)) {
READWRITE(nSaplingValue);
}
if ( (s.GetType() & SER_DISK) && (is_STAKED(ASSETCHAINS_SYMBOL) != 0) )
{
READWRITE(nNotaryPay);
READWRITE(segid);
}
}
uint256 GetBlockHash() const

4
src/komodo_nk.h

@ -1,7 +1,7 @@
#ifndef KOMODO_NK_H
#define KOMODO_NK_H
#define ASSETCHAINS_N 96
#define ASSETCHAINS_K 5
#define ASSETCHAINS_N 77
#define ASSETCHAINS_K 3
#endif

4
src/main.cpp

@ -3714,11 +3714,11 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
//FlushStateToDisk();
komodo_connectblock(false,pindex,*(CBlock *)&block); // dPoW state update.
if ( ASSETCHAINS_NOTARY_PAY[0] != 0 && pindex->GetHeight() > 10 )
if ( ASSETCHAINS_NOTARY_PAY[0] != 0 )
{
// Update the notary pay with the latest payment.
pindex->nNotaryPay = pindex->pprev->nNotaryPay + notarypaycheque;
fprintf(stderr, "total notary pay.%li\n", pindex->nNotaryPay);
//fprintf(stderr, "total notary pay.%li\n", pindex->nNotaryPay);
}
return true;
}

Loading…
Cancel
Save