Browse Source

add src and fix

blackjok3r
blackjok3r 6 years ago
parent
commit
e9010d7b6b
  1. 28
      iguana/dpow/dpow_fsm.c

28
iguana/dpow/dpow_fsm.c

@ -658,6 +658,34 @@ void dpow_statemachinestart(void *ptr)
fprintf(stderr, "rebroadcast failed!\n");
// get the confirms for srctxid
if ( srcnotarized == 0 && (src_confs= dpow_txconfirms(myinfo, bp->srccoin, bp->srctxid, rettx)) != -1 )
{
if ( srctx[0] == 0 && rettx[0] != 0 )
{
memcpy(srctx, rettx, strlen(rettx)+1);
fprintf(stderr, "srctx.%s\n", srctx);
}
if ( src_confs > 2 )
{
// tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost!
fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%i\n", dp->symbol, bits256_str(str,bp->srctxid), src_confs));
srcnotarized = 1;
}
else if ( src_confs == 0 )
{
// not confirmed, rebroadcast it.
fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting....\n tx.%s", dp->symbol, bits256_str(str,bp->srctxid), srctx);
if ( srctx[0] != 0 )
send_src = 1;
}
}
else if ( srctx[0] != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it.
{
fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->srctxid));
send_src = 1;
}
if ( send_src == 1 && dpow_sendrawtransaction(myinfo, bp->srccoin, srctx) == 0 )
fprintf(stderr, "rebroadcast failed!\n");
// wait for approx one block before checking again.
sleep(30);

Loading…
Cancel
Save