From 9dd28ae0a3866ef149ea036c8f21f968c003abb0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 9 Apr 2018 22:41:04 +0300 Subject: [PATCH] Test --- src/komodo_gateway.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 2a2f1f190..acd0efed7 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -786,7 +786,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim } else { - if ( ASSETCHAINS_STAKED != 0 ) + if ( ASSETCHAINS_STAKED != 0 && height >= 2 ) { arith_uint256 bnTarget; bool fNegative,fOverflow; CBlockIndex *previndex; uint32_t eligible; if ( prevtime == 0 ) @@ -795,8 +795,10 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim prevtime = (uint32_t)previndex->nTime; } bnTarget.SetCompact(block.nBits, &fNegative, &fOverflow); - eligible = komodo_stake(bnTarget,height,block.vtx[txn_count-1].vin[0].prevout.hash,block.vtx[txn_count-1].vin[0].prevout.n,block.nTime,prevtime); - if ( height >= 2 && (eligible == 0 || eligible > block.nTime) ) + if ( txn_count == 1 ) + eligible = komodo_stake(bnTarget,height,block.vtx[0].vout[0].hash,0,block.nTime,prevtime); + else eligible = komodo_stake(bnTarget,height,block.vtx[txn_count-1].vin[0].prevout.hash,block.vtx[txn_count-1].vin[0].prevout.n,block.nTime,prevtime); + if ( eligible == 0 || eligible > block.nTime ) { fprintf(stderr,"eligible.%u vs blocktime.%u, lag.%d\n",eligible,(uint32_t)block.nTime,(int32_t)(eligible - block.nTime)); return(-1);