Browse Source

try

blackjok3r
blackjok3r 6 years ago
parent
commit
a7a95d8233
  1. 19
      iguana/dpow/dpow_fsm.c
  2. 2
      iguana/dpow/dpow_rpc.c

19
iguana/dpow/dpow_fsm.c

@ -629,33 +629,30 @@ void dpow_statemachinestart(void *ptr)
// get the confirms for desttxid
if ( destnotarized == 0 && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 )
{
if ( desttx[0] == 0 )
{
strcpy(rettx,desttx);
fprintf(stderr, "desttx.%s\n", desttx);
}
if ( dest_confs > 2 )
{
// tx is notarized. or it has 100+ raw confirms.
fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms \n",dp->dest, bits256_str(str,bp->desttxid));
fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms\n",dp->dest, bits256_str(str,bp->desttxid));
destnotarized = 1;
}
else if ( dest_confs == 0 )
{
// not confirmed, rebroadcast it.
fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting.... \n tx.%s",dp->dest, bits256_str(str,bp->desttxid), rettx);
fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting....\n tx.%s",dp->dest, bits256_str(str,bp->desttxid), desttx);
if ( desttx[0] != 0 )
{
if ( dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 )
fprintf(stderr, "rebroadcast failed!\n");
}
}
} else fprintf(stderr, "[%s] txid.%s returned error for txconfirms",dp->dest, bits256_str(str,bp->desttxid));
} else fprintf(stderr, "[%s] txid.%s returned error for dpow_txconfirms",dp->dest, bits256_str(str,bp->desttxid));
// get the confirms for srctxid
/*if ( (src_confs= dpow_txconfirms(myinfo, bp->srccoin, bp->srctxid)) != -1 )
{
if ( dest_confs > 2 )
{
// tx is notarized. or it has 100+ raw confirms.
fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms \n",bp->symbol, bits256_str(str,bp->srctxid));
}
} */
// wait for approx one block before checking again.
sleep(30);

2
iguana/dpow/dpow_rpc.c

@ -546,7 +546,7 @@ int32_t dpow_txconfirms(struct supernet_info *myinfo,struct iguana_info *coin,bi
cJSON *txobj; int32_t confirms = 0, ret = 0;
if ( (txobj= dpow_gettransaction(myinfo, coin, txid)) != 0 )
{
rawtx= jstr(txobj, "hex");
memcpy(rawtx, jstr(txobj, "hex"), sizeof(jstr(txobj, "hex")+1);
if ( (confirms= juint(txobj, "confirmations")) != 0 )
{
ret = confirms;

Loading…
Cancel
Save