From 9273e756a15505be174288e6dc40ef923e540de1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 18 Nov 2016 11:10:51 -0300 Subject: [PATCH] test --- src/komodo.h | 11 ++++++++++- src/komodo_bitcoind.h | 3 +-- src/komodo_structs.h | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index e6f44ff02..764a0a5fa 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -426,10 +426,19 @@ int32_t komodo_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys void komodo_connectblock(CBlockIndex *pindex,CBlock& block) { static int32_t hwmheight; - uint64_t signedmask,voutmask; + uint64_t signedmask,voutmask; char symbol[16],dest[16]; struct komodo_state *sp; uint8_t scriptbuf[4096],pubkeys[64][33],rmd160[20],scriptPubKey[35]; uint256 kmdtxid,btctxid,txhash; int32_t i,j,k,numnotaries,scriptlen,isratification,nid,numvalid,specialtx,notarizedheight,notaryid,len,numvouts,numvins,height,txn_count; komodo_init(pindex->nHeight); + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + if ( sp->rewinding != 0 ) + { + printf("sp->rewinding.%d connect.%d\n",sp->rewinding,pindex->nHeight); + komodo_event_rewind(sp,symbol,pindex->nHeight); + // komodo_stateupdate(); + } + } numnotaries = komodo_notaries(pubkeys,pindex->nHeight); calc_rmd160_sha256(rmd160,pubkeys[0],33); if ( pindex->nHeight > hwmheight ) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 445f8dba6..3560d1fd1 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -378,8 +378,7 @@ void komodo_disconnect(CBlockIndex *pindex,CBlock& block) char symbol[16],dest[16]; struct komodo_state *sp; komodo_init(pindex->nHeight); if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - komodo_event_rewind(sp,symbol,pindex->nHeight); - // add rewind entry komodo_stateupdate(); + sp->rewinding = pindex->nHeight; } int32_t komodo_is_notarytx(const CTransaction& tx) diff --git a/src/komodo_structs.h b/src/komodo_structs.h index f3a572fdc..dd653fc37 100644 --- a/src/komodo_structs.h +++ b/src/komodo_structs.h @@ -38,6 +38,6 @@ struct notarized_checkpoint { uint256 notarized_hash,notarized_desttxid; int32_t struct komodo_state { uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID; - int32_t CURRENT_HEIGHT,NOTARIZED_HEIGHT; + int32_t CURRENT_HEIGHT,NOTARIZED_HEIGHT,rewinding; // gateway state };