@@ -584,7 +584,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
584
584
PENDING_KOMODO_TX += pax -> komodoshis ;
585
585
printf (" len.%d vout.%u DEPOSIT %.8f <- pax.%s pending ht %d %d %.8f | " ,len ,pax -> vout ,(double )txNew -> vout [numvouts ].nValue /COIN ,symbol ,pax -> height ,pax -> otherheight ,dstr (PENDING_KOMODO_TX ));
586
586
}
587
- if ( numvouts ++ >= 64 )
587
+ if ( numvouts ++ >= 64 || sum > COIN )
588
588
break ;
589
589
}
590
590
if ( numvouts > 1 )
@@ -652,7 +652,8 @@ void komodo_passport_iteration();
652
652
int32_t komodo_check_deposit (int32_t height ,const CBlock & block ) // verify above block is valid pax pricing
653
653
{
654
654
static uint256 array [64 ]; static int32_t numbanned ,indallvouts ;
655
- int32_t i ,j ,k ,n ,ht ,baseid ,txn_count ,num ,opretlen ,offset = 1 ,errs = 0 ,matched = 0 ,kmdheights [64 ],otherheights [64 ]; uint256 hash ,txids [64 ]; char symbol [16 ],base [16 ]; uint16_t vouts [64 ]; int8_t baseids [64 ]; uint8_t * script ,opcode ,rmd160s [64 * 20 ]; uint64_t total ,available ,deposited ,issued ,withdrawn ,approved ,redeemed ; int64_t values [64 ],srcvalues [64 ]; struct pax_transaction * pax ; struct komodo_state * sp ;
655
+ int32_t i ,j ,k ,n ,ht ,baseid ,txn_count ,activation ,num ,opretlen ,offset = 1 ,errs = 0 ,matched = 0 ,kmdheights [64 ],otherheights [64 ]; uint256 hash ,txids [64 ]; char symbol [16 ],base [16 ]; uint16_t vouts [64 ]; int8_t baseids [64 ]; uint8_t * script ,opcode ,rmd160s [64 * 20 ]; uint64_t total ,available ,deposited ,issued ,withdrawn ,approved ,redeemed ,checktoshis ,seed ; int64_t values [64 ],srcvalues [64 ]; struct pax_transaction * pax ; struct komodo_state * sp ;
656
+ activation = 235300 ;
656
657
if ( * (int32_t * )& array [0 ] == 0 )
657
658
numbanned = komodo_bannedset (& indallvouts ,array ,(int32_t )(sizeof (array )/sizeof (* array )));
658
659
memset (baseids ,0xff ,sizeof (baseids ));
@@ -706,7 +707,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
706
707
if ( overflow != 0 || total > COIN /10 )
707
708
{
708
709
//fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",height,dstr(block.vtx[0].vout[1].nValue),n);
709
- if ( height >= 235300 )
710
+ if ( height >= activation )
710
711
return (-1 );
711
712
}
712
713
}
@@ -938,7 +939,17 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
938
939
{
939
940
}
940
941
if ( strcmp (ASSETCHAINS_SYMBOL ,CURRENCIES [baseids [i - 1 ]]) == 0 )
941
- printf ("check deposit validates %s.%d [%d] %.8f -> %.8f (%.8f %.8f %.8f)\n" ,CURRENCIES [baseids [i - 1 ]],height ,i ,dstr (srcvalues [i - 1 ]),dstr (values [i - 1 ]),dstr (pax -> komodoshis ),dstr (pax -> fiatoshis ),dstr (block .vtx [0 ].vout [i ].nValue ));
942
+ {
943
+ //check deposit validates AUD.1047 [3] 0.14585530 -> 0.01000000 (0.14585530 0.01000000 0.01000000)
944
+ char destaddr [64 ],coinaddr [64 ]; uint8_t pubkey33 [33 ];
945
+ checktoshis = PAX_fiatdest (& seed ,0 ,destaddr ,pubkey33 ,coinaddr ,pax -> height ,CURRENCIES [baseids [i - 1 ]],pax -> fiatoshis );
946
+ //checktoshis = komodo_paxprice(&seed,pax->height,CURRENCIES[baseids[i-1]],(char *)"KMD",(uint64_t)pax->komodoshis);
947
+ if ( komodo_paxcmp (CURRENCIES [baseids [i - 1 ]],pax -> height ,pax -> komodoshis ,checktoshis ,seed ) < 0 )
948
+ {
949
+ printf ("paxcmp FAIL when check deposit validates %s.%d [%d] %.8f -> %.8f (%.8f %.8f %.8f)\n" ,CURRENCIES [baseids [i - 1 ]],height ,i ,dstr (srcvalues [i - 1 ]),dstr (values [i - 1 ]),dstr (pax -> komodoshis ),dstr (pax -> fiatoshis ),dstr (block .vtx [0 ].vout [i ].nValue ));
950
+ return (-1 );
951
+ } //else printf("check deposit validates %s.%d [%d] %.8f -> %.8f (%.8f %.8f %.8f)\n",CURRENCIES[baseids[i-1]],height,i,dstr(srcvalues[i-1]),dstr(values[i-1]),dstr(pax->komodoshis),dstr(pax->fiatoshis),dstr(block.vtx[0].vout[i].nValue));
952
+ }
942
953
}
943
954
else if ( strcmp (ASSETCHAINS_SYMBOL ,CURRENCIES [baseids [i - 1 ]]) == 0 )
944
955
{
@@ -955,12 +966,13 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
955
966
for (j = 0 ; j < 32 ; j ++ )
956
967
printf ("%02x" ,((uint8_t * )& hash )[j ]);
957
968
printf (" kht.%d ht.%d %.8f %.8f blockhash couldnt find vout.[%d] ht.%d %s for [%s]\n" ,kmdheights [i - 1 ],otherheights [i - 1 ],dstr (values [i - 1 ]),dstr (srcvalues [i ]),i ,height ,ASSETCHAINS_SYMBOL ,CURRENCIES [baseids [i - 1 ]]);
958
- return (-1 );
969
+ if ( ASSETCHAINS_SYMBOL [0 ] != 0 || height >= activation )
970
+ return (-1 );
959
971
}
960
972
}
961
973
if ( ASSETCHAINS_SYMBOL [0 ] == 0 )
962
974
{
963
- if ( height > 0 && (height < chainActive .Tip ()-> nHeight || (height >= chainActive .Tip ()-> nHeight && komodo_isrealtime (& ht ) != 0 )) && matched != num )
975
+ /* if ( height > 0 && (height < chainActive.Tip()->nHeight || (height >= chainActive.Tip()->nHeight && komodo_isrealtime(&ht) != 0)) && matched != num )
964
976
{
965
977
printf("WOULD REJECT %s: ht.%d (%c) matched.%d vs num.%d tip.%d isRT.%d\n",symbol,height,opcode,matched,num,(int32_t)chainActive.Tip()->nHeight,komodo_isrealtime(&ht));
966
978
// can easily happen depending on order of loading
@@ -969,7 +981,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
969
981
printf("REJECT: ht.%d (%c) matched.%d vs num.%d\n",height,opcode,matched,num);
970
982
return(-1);
971
983
}
972
- }
984
+ }*/ // disabled 'X' path
973
985
}
974
986
else
975
987
{
@@ -985,7 +997,8 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
985
997
for (i = 0 ; i < n ; i ++ )
986
998
printf ("%.8f " ,dstr (block .vtx [0 ].vout [i ].nValue ));
987
999
printf ("no opreturn entries to check ht.%d %s\n" ,height ,ASSETCHAINS_SYMBOL );
988
- return (-1 );
1000
+ if ( ASSETCHAINS_SYMBOL [0 ] != 0 || height >= activation )
1001
+ return (-1 );
989
1002
}
990
1003
//printf("opretlen.%d num.%d\n",opretlen,num);
991
1004
}
@@ -995,7 +1008,6 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
995
1008
printf ("%02x" ,script [i ]);
996
1009
printf (" height.%d checkdeposit n.%d [%02x] [%c] %d len.%d " ,height ,n ,script [0 ],script [offset ],script [offset ],opretlen );
997
1010
printf ("not proper vout with opreturn format %s ht.%d\n" ,ASSETCHAINS_SYMBOL ,height );
998
- exit (-1 );
999
1011
return (-1 );
1000
1012
}
1001
1013
return (0 );
@@ -1090,7 +1102,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
1090
1102
{
1091
1103
basesp -> issued += pax2 -> fiatoshis ;
1092
1104
pax2 -> didstats = 1 ;
1093
- if ( 1 && strcmp (base ,"USD" ) == 0 )
1105
+ if ( 0 && strcmp (base ,"USD" ) == 0 )
1094
1106
printf ("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d [%d]\n" ,basesp ,base ,dstr (pax2 -> fiatoshis ),pax2 -> height ,dstr (pax2 -> komodoshis ),pax2 -> otherheight ,height );
1095
1107
}
1096
1108
}
0 commit comments