fix wallet expired on load, fix pindex->segid for PoW.

This commit is contained in:
blackjok3r
2019-01-10 23:16:28 +08:00
parent 5cb458b5f2
commit 2cbde4d787
2 changed files with 20 additions and 6 deletions

View File

@@ -1460,7 +1460,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_
{
if ( 0 && ASSETCHAINS_STAKED < 100 )
fprintf(stderr,"komodo_is_PoSblock PoS failure ht.%d eligible.%u vs blocktime.%u, lag.%d -> check to see if it is PoW block\n",height,eligible,(uint32_t)pblock->nTime,(int32_t)(eligible - pblock->nTime));
if ( slowflag != 0 && pindex != 0 )
if ( slowflag != 0 && pindex != 0 && height > 100)
{
pindex->segid = -1;
//fprintf(stderr,"PoW block detected set segid.%d <- %d\n",height,pindex->segid);
@@ -1481,7 +1481,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_
if ( pindex != 0 && segid >= 0 )
{
pindex->segid = segid;
//fprintf(stderr,"B set segid.%d <- %d\n",height,pindex->segid);
fprintf(stderr,"PoS block set segid.%d <- %d\n",height,pindex->segid);
} //else fprintf(stderr,"unexpected null pindex for slowflag set ht.%d segid.%d:%d\n",height,pindex!=0?pindex->segid:-3,segid);
}
}
@@ -1817,7 +1817,18 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
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);
return(-1);
} else failed = 0;
} else
{
// I think this means the block is valid PoW. We need to set the pindex->segid here.
failed = 0;
CBlockIndex *pindex;
BlockMap::const_iterator it = mapBlockIndex.find(pblock->GetHash());
pindex = it != mapBlockIndex.end() ? it->second : NULL;
if ( pindex != 0 && height > 100 && pindex->segid == -2 ) {
pindex->segid = -1;
fprintf(stderr,"PoW block detected set segid.%d <- %d\n",height,pindex->segid);
}
}
}
}
else if ( is_PoSblock < 0 )

View File

@@ -486,9 +486,12 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
auto verifier = libzcash::ProofVerifier::Strict();
if (!(CheckTransaction(0,wtx, state, verifier) && (wtx.GetHash() == hash) && state.IsValid()))
{
fprintf(stderr, "Removing corrupt tx from wallet.%s\n", hash.ToString().c_str());
deadTxns.push_back(hash);
return false;
if (state.GetRejectReason() != "tx-overwinter-expired")
{
fprintf(stderr, "Removing corrupt tx from wallet.%s\n", hash.ToString().c_str());
deadTxns.push_back(hash);
return false;
}
}
// Undo serialize changes in 31600
if (31404 <= wtx.fTimeReceivedIsTxTime && wtx.fTimeReceivedIsTxTime <= 31703)