From ca15eea20c38f60c6165afa35c40acc408ce6950 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 14:59:27 +0800 Subject: [PATCH] test --- iguana/dpow/dpow_fsm.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 6d5abf36f..1174e0cb3 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -564,6 +564,7 @@ void dpow_statemachinestart(void *ptr) else src_or_dest = 1; extralen = dpow_paxpending(myinfo,extras,sizeof(extras),&bp->paxwdcrc,bp->MoM,bp->MoMdepth,bp->CCid,src_or_dest,bp); // if MoMoM is not avalible yet, then stop this round and try again later. + // This might no longer be needed... It can stop notarizations dead if they have not happened for 1440 blocks. if ( extralen == -1 ) break; bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc; @@ -613,6 +614,29 @@ void dpow_statemachinestart(void *ptr) dp->lastrecvmask = bp->recvmask; dp->ratifying -= bp->isratify; + // If the round was sucessful and both notarizations were created successfully we will make sure they are in the chain. + // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, + // becasue the mempool is stupid after sapling update! + if ( bp->desttxid != 0 ) + fprintf(stderr, "desttxid.%s\n", bits256_str(str,bp->desttxid)); + else + fprintf(stderr, "dest tx was never sent!\n"); + if ( bp->srctxid != 0 ) + fprintf(stderr, "srctxid.%s\n", bits256_str(str,bp->srctxid)); + else + fprintf(stderr, "src tx was never sent!\n"); + while ( 0 ) + { + // dpow_gettransaction will return confirms, unless its not confirmed. + // check here for confirms exists in return JSON, if no confirms, keep rebroadcasting every 60s + // if confirms > 2 exit loop. + + // as a safety, if rawconfirmations > 100 exit this loop. + + // wait for approx one block before checking again. + sleep(60); + } + // unlock the dest utxo on KMD. if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) {