From dd8b6f9342b014f6df787e26ea505d74afd0b3c6 Mon Sep 17 00:00:00 2001 From: Artem Pikulin Date: Tue, 1 Jan 2019 14:37:14 +0700 Subject: [PATCH] Allow sending dexfee to old address for a while. --- iguana/exchanges/LP_etomic.c | 6 ++++-- iguana/exchanges/LP_include.h | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_etomic.c b/iguana/exchanges/LP_etomic.c index 5e8eb7787..ed37f939f 100644 --- a/iguana/exchanges/LP_etomic.c +++ b/iguana/exchanges/LP_etomic.c @@ -59,7 +59,7 @@ uint8_t LP_etomic_verify_alice_fee(struct basilisk_swap *swap) } if ( strcmp(swap->I.alicestr,"ETH") == 0 ) { - if (compareAddresses(data.to, INSTANTDEX_ETHADDR) == 0) { + if (compareAddresses(data.to, INSTANTDEX_ETHADDR) == 0 && compareAddresses(data.to, INSTANTDEX_OLD_ETHADDR) == 0) { printf("Alice fee %s was sent to wrong address %s\n", swap->otherfee.I.ethTxid, data.to); return(0); } @@ -78,7 +78,9 @@ uint8_t LP_etomic_verify_alice_fee(struct basilisk_swap *swap) } char weiAmount[70]; satoshisToWei(weiAmount, LP_DEXFEE(swap->I.alicerealsat)); - return(verifyAliceErc20FeeData(swap->I.alicetomic, INSTANTDEX_ETHADDR, weiAmount, data.input, alicecoin->decimals)); + uint8_t verify_new = verifyAliceErc20FeeData(swap->I.alicetomic, INSTANTDEX_ETHADDR, weiAmount, data.input, alicecoin->decimals); + uint8_t verify_old = verifyAliceErc20FeeData(swap->I.alicetomic, INSTANTDEX_OLD_ETHADDR, weiAmount, data.input, alicecoin->decimals); + return((uint8_t)(verify_new || verify_old)); } } diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 1a30675ec..b30be5b34 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -113,6 +113,11 @@ void emscripten_usleep(int32_t x); // returns immediate, no sense for sleeping #define INSTANTDEX_INSURANCEDIV 777 #define INSTANTDEX_PUBKEY "03bc2c7ba671bae4a6fc835244c9762b41647b9827d4780a89a949b984a8ddcc06" #define INSTANTDEX_ETHADDR "0xd8997941dd1346e9231118d5685d866294f59e5b" +// Artem Pikulin: +// This is invalid address got from zero pubkey because of error in pubKey2Addr(char* pubKey) +// Going to keep it for a while because some nodes might be not updated and still send fee to old address. +// I think it's better to allow swap to continue even if fee sent to wrong address. +#define INSTANTDEX_OLD_ETHADDR "0x3f17f1962B36e491b30A40b2405849e597Ba5FB5" #define INSTANTDEX_RMD160 "ca1e04745e8ca0c60d8c5881531d51bec470743f" #define JUMBLR_RMD160 "5177f8b427e5f47342a4b8ab5dac770815d4389e" #define TIERNOLAN_RMD160 "daedddd8dbe7a2439841ced40ba9c3d375f98146"