Merge pull request #1302 from jl777/jl777
fix MTST3 sync, support up to 90billion ac_supply
This commit is contained in:
@@ -2126,7 +2126,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
bnTarget = komodo_PoWtarget(&PoSperc,bnTarget,height,ASSETCHAINS_STAKED);
|
bnTarget = komodo_PoWtarget(&PoSperc,bnTarget,height,ASSETCHAINS_STAKED);
|
||||||
if ( bhash > bnTarget )
|
if ( bhash > bnTarget && height > 100 )
|
||||||
{
|
{
|
||||||
for (i=31; i>=16; i--)
|
for (i=31; i>=16; i--)
|
||||||
fprintf(stderr,"%02x",((uint8_t *)&bhash)[i]);
|
fprintf(stderr,"%02x",((uint8_t *)&bhash)[i]);
|
||||||
@@ -2135,7 +2135,8 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
|||||||
fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]);
|
fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]);
|
||||||
fprintf(stderr," ht.%d PoW diff violation PoSperc.%d vs goalperc.%d\n",height,PoSperc,(int32_t)ASSETCHAINS_STAKED);
|
fprintf(stderr," ht.%d PoW diff violation PoSperc.%d vs goalperc.%d\n",height,PoSperc,(int32_t)ASSETCHAINS_STAKED);
|
||||||
return(-1);
|
return(-1);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
failed = 0;
|
failed = 0;
|
||||||
CBlockIndex *pindex;
|
CBlockIndex *pindex;
|
||||||
|
|||||||
@@ -34,6 +34,10 @@
|
|||||||
#define GETBIT(bits,bitoffset) (((uint8_t *)bits)[(bitoffset) >> 3] & (1 << ((bitoffset) & 7)))
|
#define GETBIT(bits,bitoffset) (((uint8_t *)bits)[(bitoffset) >> 3] & (1 << ((bitoffset) & 7)))
|
||||||
#define CLEARBIT(bits,bitoffset) (((uint8_t *)bits)[(bitoffset) >> 3] &= ~(1 << ((bitoffset) & 7)))
|
#define CLEARBIT(bits,bitoffset) (((uint8_t *)bits)[(bitoffset) >> 3] &= ~(1 << ((bitoffset) & 7)))
|
||||||
|
|
||||||
|
#define KOMODO_MAXNVALUE (((uint64_t)1 << 63) - 1)
|
||||||
|
#define KOMODO_BIT63SET(x) ((x) & ((uint64_t)1 << 63))
|
||||||
|
#define KOMODO_VALUETOOBIG(x) ((x) > (uint64_t)10000000000*COIN)
|
||||||
|
|
||||||
extern uint8_t ASSETCHAINS_TXPOW,ASSETCHAINS_PUBLIC;
|
extern uint8_t ASSETCHAINS_TXPOW,ASSETCHAINS_PUBLIC;
|
||||||
int32_t MAX_BLOCK_SIZE(int32_t height);
|
int32_t MAX_BLOCK_SIZE(int32_t height);
|
||||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ uint64_t komodo_current_supply(uint32_t nHeight)
|
|||||||
cur_money = (ASSETCHAINS_SUPPLY+1) * SATOSHIDEN + (ASSETCHAINS_MAGIC & 0xffffff) + ASSETCHAINS_GENESISTXVAL;
|
cur_money = (ASSETCHAINS_SUPPLY+1) * SATOSHIDEN + (ASSETCHAINS_MAGIC & 0xffffff) + ASSETCHAINS_GENESISTXVAL;
|
||||||
if ( ASSETCHAINS_LASTERA == 0 && ASSETCHAINS_REWARD[0] == 0 )
|
if ( ASSETCHAINS_LASTERA == 0 && ASSETCHAINS_REWARD[0] == 0 )
|
||||||
{
|
{
|
||||||
cur_money += (nHeight * 10000) / SATOSHIDEN;
|
cur_money += (nHeight * 10000);// / SATOSHIDEN;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -263,10 +263,7 @@ uint64_t komodo_current_supply(uint32_t nHeight)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#define KOMODO_MAXNVALUE (((uint64_t)1 << 63) - 1)
|
|
||||||
#define KOMODO_BIT63SET(x) ((x) & ((uint64_t)1 << 63))
|
|
||||||
|
|
||||||
if ( KOMODO_BIT63SET(cur_money) != 0 )
|
if ( KOMODO_BIT63SET(cur_money) != 0 )
|
||||||
return(KOMODO_MAXNVALUE);
|
return(KOMODO_MAXNVALUE);
|
||||||
if ( ASSETCHAINS_COMMISSION != 0 )
|
if ( ASSETCHAINS_COMMISSION != 0 )
|
||||||
@@ -278,5 +275,6 @@ uint64_t komodo_current_supply(uint32_t nHeight)
|
|||||||
return(KOMODO_MAXNVALUE);
|
return(KOMODO_MAXNVALUE);
|
||||||
return(newval);
|
return(newval);
|
||||||
}
|
}
|
||||||
|
fprintf(stderr,"cur_money %.8f\n",(double)cur_money/COIN);
|
||||||
return(cur_money);
|
return(cur_money);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1639,9 +1639,18 @@ uint64_t komodo_ac_block_subsidy(int nHeight)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( nHeight == 1 )
|
uint32_t magicExtra = ASSETCHAINS_STAKED ? ASSETCHAINS_MAGIC : (ASSETCHAINS_MAGIC & 0xffffff);
|
||||||
|
if ( ASSETCHAINS_SUPPLY > 10000000000 ) // over 10 billion?
|
||||||
|
{
|
||||||
|
if ( nHeight <= ASSETCHAINS_SUPPLY/1000000000 )
|
||||||
|
{
|
||||||
|
subsidy += (uint64_t)1000000000 * COIN;
|
||||||
|
if ( nHeight == 1 )
|
||||||
|
subsidy += (ASSETCHAINS_SUPPLY % 1000000000)*COIN + magicExtra;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( nHeight == 1 )
|
||||||
{
|
{
|
||||||
uint32_t magicExtra = ASSETCHAINS_STAKED ? ASSETCHAINS_MAGIC : (ASSETCHAINS_MAGIC & 0xffffff);
|
|
||||||
if ( ASSETCHAINS_LASTERA == 0 )
|
if ( ASSETCHAINS_LASTERA == 0 )
|
||||||
subsidy = ASSETCHAINS_SUPPLY * SATOSHIDEN + magicExtra;
|
subsidy = ASSETCHAINS_SUPPLY * SATOSHIDEN + magicExtra;
|
||||||
else
|
else
|
||||||
@@ -1792,6 +1801,8 @@ void komodo_args(char *argv0)
|
|||||||
fprintf(stderr,"-ac_supply must be less than 90 billion\n");
|
fprintf(stderr,"-ac_supply must be less than 90 billion\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
fprintf(stderr,"ASSETCHAINS_SUPPLY %llu\n",(long long)ASSETCHAINS_SUPPLY);
|
||||||
|
|
||||||
ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0);
|
ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0);
|
||||||
ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey","");
|
ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey","");
|
||||||
ASSETCHAINS_SCRIPTPUB = GetArg("-ac_script","");
|
ASSETCHAINS_SCRIPTPUB = GetArg("-ac_script","");
|
||||||
@@ -1885,6 +1896,11 @@ void komodo_args(char *argv0)
|
|||||||
}
|
}
|
||||||
if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 || ASSETCHAINS_SCRIPTPUB.size() > 1 )
|
if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 || ASSETCHAINS_SCRIPTPUB.size() > 1 )
|
||||||
{
|
{
|
||||||
|
if ( ASSETCHAINS_SUPPLY > 10000000000 )
|
||||||
|
{
|
||||||
|
printf("ac_pubkey or ac_script wont work with ac_supply over 10 billion\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
if ( ASSETCHAINS_NOTARY_PAY[0] != 0 )
|
if ( ASSETCHAINS_NOTARY_PAY[0] != 0 )
|
||||||
{
|
{
|
||||||
printf("Assetchains NOTARY PAY cannot be used with ac_pubkey or ac_script.\n");
|
printf("Assetchains NOTARY PAY cannot be used with ac_pubkey or ac_script.\n");
|
||||||
@@ -2049,9 +2065,9 @@ void komodo_args(char *argv0)
|
|||||||
|
|
||||||
if ( ASSETCHAINS_CC >= KOMODO_FIRSTFUNGIBLEID && MAX_MONEY < 1000000LL*SATOSHIDEN )
|
if ( ASSETCHAINS_CC >= KOMODO_FIRSTFUNGIBLEID && MAX_MONEY < 1000000LL*SATOSHIDEN )
|
||||||
MAX_MONEY = 1000000LL*SATOSHIDEN;
|
MAX_MONEY = 1000000LL*SATOSHIDEN;
|
||||||
if ( MAX_MONEY <= 0 || MAX_MONEY > 10000100000LL*SATOSHIDEN )
|
if ( KOMODO_BIT63SET(MAX_MONEY) != 0 )
|
||||||
MAX_MONEY = 10000100000LL*SATOSHIDEN;
|
MAX_MONEY = KOMODO_MAXNVALUE;
|
||||||
//fprintf(stderr,"MAX_MONEY %llu %.8f\n",(long long)MAX_MONEY,(double)MAX_MONEY/SATOSHIDEN);
|
fprintf(stderr,"MAX_MONEY %llu %.8f\n",(long long)MAX_MONEY,(double)MAX_MONEY/SATOSHIDEN);
|
||||||
//printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN);
|
//printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN);
|
||||||
uint16_t tmpport = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen);
|
uint16_t tmpport = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen);
|
||||||
if ( GetArg("-port",0) != 0 )
|
if ( GetArg("-port",0) != 0 )
|
||||||
|
|||||||
25
src/main.cpp
25
src/main.cpp
@@ -1808,7 +1808,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
CAmount nValueOut = tx.GetValueOut();
|
CAmount nValueOut = tx.GetValueOut();
|
||||||
CAmount nFees = nValueIn-nValueOut;
|
CAmount nFees = nValueIn-nValueOut;
|
||||||
double dPriority = view.GetPriority(tx, chainActive.Height());
|
double dPriority = view.GetPriority(tx, chainActive.Height());
|
||||||
if ( KOMODO_BIT63SET(nValueOut) != 0 )
|
if ( KOMODO_VALUETOOBIG(nValueOut - 777777*COIN) != 0 ) // some room for blockreward and txfees
|
||||||
return state.DoS(100, error("AcceptToMemoryPool: GetValueOut too big"),REJECT_INVALID,"tx valueout is too big");
|
return state.DoS(100, error("AcceptToMemoryPool: GetValueOut too big"),REJECT_INVALID,"tx valueout is too big");
|
||||||
|
|
||||||
// Keep track of transactions that spend a coinbase, which we re-scan
|
// Keep track of transactions that spend a coinbase, which we re-scan
|
||||||
@@ -2845,7 +2845,7 @@ namespace {
|
|||||||
hasher << hashBlock;
|
hasher << hashBlock;
|
||||||
hasher << blockundo;
|
hasher << blockundo;
|
||||||
fileout << hasher.GetHash();
|
fileout << hasher.GetHash();
|
||||||
|
//fprintf(stderr,"hashBlock.%s hasher.%s\n",hashBlock.GetHex().c_str(),hasher.GetHash().GetHex().c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2870,7 +2870,7 @@ namespace {
|
|||||||
hasher << hashBlock;
|
hasher << hashBlock;
|
||||||
hasher << blockundo;
|
hasher << blockundo;
|
||||||
if (hashChecksum != hasher.GetHash())
|
if (hashChecksum != hasher.GetHash())
|
||||||
return error("%s: Checksum mismatch", __func__);
|
return error("%s: %s Checksum mismatch %s vs %s", __func__,hashBlock.GetHex().c_str(),hashChecksum.GetHex().c_str(),hasher.GetHash().GetHex().c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3494,12 +3494,18 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
txdata.emplace_back(tx);
|
txdata.emplace_back(tx);
|
||||||
|
|
||||||
valueout = tx.GetValueOut();
|
valueout = tx.GetValueOut();
|
||||||
if ( KOMODO_BIT63SET(valueout) != 0 )
|
if ( KOMODO_VALUETOOBIG(valueout) != 0 )
|
||||||
|
{
|
||||||
|
fprintf(stderr,"valueout %.8f too big\n",(double)valueout/COIN);
|
||||||
return state.DoS(100, error("ConnectBlock(): GetValueOut too big"),REJECT_INVALID,"tx valueout is too big");
|
return state.DoS(100, error("ConnectBlock(): GetValueOut too big"),REJECT_INVALID,"tx valueout is too big");
|
||||||
|
}
|
||||||
prevsum = voutsum;
|
prevsum = voutsum;
|
||||||
voutsum += valueout;
|
voutsum += valueout;
|
||||||
if ( KOMODO_BIT63SET(voutsum) != 0 )
|
if ( KOMODO_VALUETOOBIG(voutsum) != 0 )
|
||||||
|
{
|
||||||
|
fprintf(stderr,"voutsum %.8f too big\n",(double)voutsum/COIN);
|
||||||
return state.DoS(100, error("ConnectBlock(): voutsum too big"),REJECT_INVALID,"tx valueout is too big");
|
return state.DoS(100, error("ConnectBlock(): voutsum too big"),REJECT_INVALID,"tx valueout is too big");
|
||||||
|
}
|
||||||
else if ( voutsum < prevsum )
|
else if ( voutsum < prevsum )
|
||||||
return state.DoS(100, error("ConnectBlock(): voutsum less after adding valueout"),REJECT_INVALID,"tx valueout is too big");
|
return state.DoS(100, error("ConnectBlock(): voutsum less after adding valueout"),REJECT_INVALID,"tx valueout is too big");
|
||||||
if (!tx.IsCoinBase())
|
if (!tx.IsCoinBase())
|
||||||
@@ -3634,9 +3640,11 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Write undo information to disk
|
// Write undo information to disk
|
||||||
|
//fprintf(stderr,"nFile.%d isNull %d vs isvalid %d nStatus %x\n",(int32_t)pindex->nFile,pindex->GetUndoPos().IsNull(),pindex->IsValid(BLOCK_VALID_SCRIPTS),(uint32_t)pindex->nStatus);
|
||||||
if (pindex->GetUndoPos().IsNull() || !pindex->IsValid(BLOCK_VALID_SCRIPTS))
|
if (pindex->GetUndoPos().IsNull() || !pindex->IsValid(BLOCK_VALID_SCRIPTS))
|
||||||
{
|
{
|
||||||
if (pindex->GetUndoPos().IsNull()) {
|
if (pindex->GetUndoPos().IsNull())
|
||||||
|
{
|
||||||
CDiskBlockPos pos;
|
CDiskBlockPos pos;
|
||||||
if (!FindUndoPos(state, pindex->nFile, pos, ::GetSerializeSize(blockundo, SER_DISK, CLIENT_VERSION) + 40))
|
if (!FindUndoPos(state, pindex->nFile, pos, ::GetSerializeSize(blockundo, SER_DISK, CLIENT_VERSION) + 40))
|
||||||
return error("ConnectBlock(): FindUndoPos failed");
|
return error("ConnectBlock(): FindUndoPos failed");
|
||||||
@@ -3644,12 +3652,11 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
fprintf(stderr,"ConnectBlock: unexpected null pprev\n");
|
fprintf(stderr,"ConnectBlock: unexpected null pprev\n");
|
||||||
if (!UndoWriteToDisk(blockundo, pos, pindex->pprev->GetBlockHash(), chainparams.MessageStart()))
|
if (!UndoWriteToDisk(blockundo, pos, pindex->pprev->GetBlockHash(), chainparams.MessageStart()))
|
||||||
return AbortNode(state, "Failed to write undo data");
|
return AbortNode(state, "Failed to write undo data");
|
||||||
|
|
||||||
// update nUndoPos in block index
|
// update nUndoPos in block index
|
||||||
pindex->nUndoPos = pos.nPos;
|
pindex->nUndoPos = pos.nPos;
|
||||||
pindex->nStatus |= BLOCK_HAVE_UNDO;
|
pindex->nStatus |= BLOCK_HAVE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that all consensus rules have been validated, set nCachedBranchId.
|
// Now that all consensus rules have been validated, set nCachedBranchId.
|
||||||
// Move this if BLOCK_VALID_CONSENSUS is ever altered.
|
// Move this if BLOCK_VALID_CONSENSUS is ever altered.
|
||||||
static_assert(BLOCK_VALID_CONSENSUS == BLOCK_VALID_SCRIPTS,
|
static_assert(BLOCK_VALID_CONSENSUS == BLOCK_VALID_SCRIPTS,
|
||||||
@@ -3660,7 +3667,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
} else if (pindex->pprev) {
|
} else if (pindex->pprev) {
|
||||||
pindex->nCachedBranchId = pindex->pprev->nCachedBranchId;
|
pindex->nCachedBranchId = pindex->pprev->nCachedBranchId;
|
||||||
}
|
}
|
||||||
|
|
||||||
pindex->RaiseValidity(BLOCK_VALID_SCRIPTS);
|
pindex->RaiseValidity(BLOCK_VALID_SCRIPTS);
|
||||||
setDirtyBlockIndex.insert(pindex);
|
setDirtyBlockIndex.insert(pindex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
}
|
}
|
||||||
} else pk = _pk;
|
} else pk = _pk;
|
||||||
|
|
||||||
uint64_t deposits; int32_t isrealtime,kmdheight; uint32_t blocktime; const CChainParams& chainparams = Params();
|
uint64_t deposits,voutsum=0; int32_t isrealtime,kmdheight; uint32_t blocktime; const CChainParams& chainparams = Params();
|
||||||
bool fNotarisationBlock = false; std::vector<int8_t> NotarisationNotaries;
|
bool fNotarisationBlock = false; std::vector<int8_t> NotarisationNotaries;
|
||||||
|
|
||||||
//fprintf(stderr,"create new block\n");
|
//fprintf(stderr,"create new block\n");
|
||||||
@@ -233,7 +233,8 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
|
|
||||||
const int64_t nMedianTimePast = pindexPrev->GetMedianTimePast();
|
const int64_t nMedianTimePast = pindexPrev->GetMedianTimePast();
|
||||||
uint32_t proposedTime = GetAdjustedTime();
|
uint32_t proposedTime = GetAdjustedTime();
|
||||||
|
voutsum = GetBlockSubsidy(nHeight,consensusParams) + 10000*COIN; // approx fees
|
||||||
|
|
||||||
if (proposedTime == nMedianTimePast)
|
if (proposedTime == nMedianTimePast)
|
||||||
{
|
{
|
||||||
// too fast or stuck, this addresses the too fast issue, while moving
|
// too fast or stuck, this addresses the too fast issue, while moving
|
||||||
@@ -270,7 +271,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
vecPriority.reserve(mempool.mapTx.size() + 1);
|
vecPriority.reserve(mempool.mapTx.size() + 1);
|
||||||
|
|
||||||
// now add transactions from the mem pool
|
// now add transactions from the mem pool
|
||||||
int32_t Notarisations = 0;
|
int32_t Notarisations = 0; uint64_t txvalue;
|
||||||
for (CTxMemPool::indexed_transaction_set::iterator mi = mempool.mapTx.begin();
|
for (CTxMemPool::indexed_transaction_set::iterator mi = mempool.mapTx.begin();
|
||||||
mi != mempool.mapTx.end(); ++mi)
|
mi != mempool.mapTx.end(); ++mi)
|
||||||
{
|
{
|
||||||
@@ -285,7 +286,12 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
//fprintf(stderr,"coinbase.%d finaltx.%d expired.%d\n",tx.IsCoinBase(),IsFinalTx(tx, nHeight, nLockTimeCutoff),IsExpiredTx(tx, nHeight));
|
//fprintf(stderr,"coinbase.%d finaltx.%d expired.%d\n",tx.IsCoinBase(),IsFinalTx(tx, nHeight, nLockTimeCutoff),IsExpiredTx(tx, nHeight));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
txvalue = tx.GetValueOut();
|
||||||
|
if ( KOMODO_VALUETOOBIG(txvalue) != 0 )
|
||||||
|
continue;
|
||||||
|
if ( KOMODO_VALUETOOBIG(txvalue + voutsum) != 0 )
|
||||||
|
continue;
|
||||||
|
voutsum += txvalue;
|
||||||
if ( ASSETCHAINS_SYMBOL[0] == 0 && komodo_validate_interest(tx,nHeight,(uint32_t)pblock->nTime,0) < 0 )
|
if ( ASSETCHAINS_SYMBOL[0] == 0 && komodo_validate_interest(tx,nHeight,(uint32_t)pblock->nTime,0) < 0 )
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"CreateNewBlock: komodo_validate_interest failure nHeight.%d nTime.%u vs locktime.%u\n",nHeight,(uint32_t)pblock->nTime,(uint32_t)tx.nLockTime);
|
//fprintf(stderr,"CreateNewBlock: komodo_validate_interest failure nHeight.%d nTime.%u vs locktime.%u\n",nHeight,(uint32_t)pblock->nTime,(uint32_t)tx.nLockTime);
|
||||||
@@ -621,7 +627,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
txNew.vout.resize(1);
|
txNew.vout.resize(1);
|
||||||
txNew.vout[0].scriptPubKey = scriptPubKeyIn;
|
txNew.vout[0].scriptPubKey = scriptPubKeyIn;
|
||||||
txNew.vout[0].nValue = GetBlockSubsidy(nHeight,consensusParams) + nFees;
|
txNew.vout[0].nValue = GetBlockSubsidy(nHeight,consensusParams) + nFees;
|
||||||
|
//fprintf(stderr,"mine ht.%d with %.8f\n",nHeight,(double)txNew.vout[0].nValue/COIN);
|
||||||
txNew.nExpiryHeight = 0;
|
txNew.nExpiryHeight = 0;
|
||||||
txNew.nLockTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
txNew.nLockTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||||
|
|
||||||
|
|||||||
@@ -419,10 +419,26 @@ bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out)
|
|||||||
int mantissa_tzeros = 0;
|
int mantissa_tzeros = 0;
|
||||||
bool mantissa_sign = false;
|
bool mantissa_sign = false;
|
||||||
bool exponent_sign = false;
|
bool exponent_sign = false;
|
||||||
int ptr = 0;
|
int i,n,ptr = 0; char *str = (char *)val.c_str();
|
||||||
int end = val.size();
|
int end = val.size();
|
||||||
int point_ofs = 0;
|
int point_ofs = 0;
|
||||||
|
n = val.size();
|
||||||
|
if ( n == 11 && (val[0] < '9' || val[1] < '3') )
|
||||||
|
{
|
||||||
|
uint64_t val64 = 0;
|
||||||
|
for (i=0; i<n; i++)
|
||||||
|
{
|
||||||
|
if ( val[i] < '0' || val[i] > '9' )
|
||||||
|
break;
|
||||||
|
val64 = (val64 * 10) + (val[i] - '0');
|
||||||
|
}
|
||||||
|
if ( i == n ) // 90000000000
|
||||||
|
{
|
||||||
|
*amount_out = val64 * 100000000;
|
||||||
|
//fprintf(stderr,"special case: %s -> %.8f\n",val.c_str(),(double)*amount_out/100000000);
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ptr < end && val[ptr] == '-') {
|
if (ptr < end && val[ptr] == '-') {
|
||||||
mantissa_sign = true;
|
mantissa_sign = true;
|
||||||
++ptr;
|
++ptr;
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr
|
|||||||
// Check amount
|
// Check amount
|
||||||
if (nValue <= 0)
|
if (nValue <= 0)
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid amount");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid amount");
|
||||||
|
//fprintf(stderr,"nValue %.8f vs curBalance %.8f\n",(double)nValue/COIN,(double)curBalance/COIN);
|
||||||
if (nValue > curBalance)
|
if (nValue > curBalance)
|
||||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds");
|
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user