Browse Source

Use inhouse parity nodes for both mainnet and testnet.

patch-3
Artem Pikulin 7 years ago
parent
commit
292ad9daab
  1. 11
      iguana/exchanges/etomicswap/etomiccurl.c
  2. 4
      iguana/exchanges/etomicswap/etomiccurl.h

11
iguana/exchanges/etomicswap/etomiccurl.c

@ -113,6 +113,12 @@ char* sendRawTxWaitConfirm(char* rawTx)
cJSON *resultJson = sendRpcRequest("eth_sendRawTransaction", params);
cJSON_Delete(params);
char *txId = NULL;
if (resultJson != NULL && is_cJSON_String(resultJson) && resultJson->valuestring != NULL) {
char* tmp = resultJson->valuestring;
txId = (char *) malloc(strlen(tmp) + 1);
strcpy(txId, tmp);
}
/*
if (resultJson != NULL && is_cJSON_String(resultJson) && resultJson->valuestring != NULL) {
char* tmp = resultJson->valuestring;
if (waitForConfirmation(tmp) > 0) {
@ -120,6 +126,7 @@ char* sendRawTxWaitConfirm(char* rawTx)
strcpy(txId, tmp);
}
}
*/
cJSON_Delete(resultJson);
pthread_mutex_unlock(&sendTxMutex);
return txId;
@ -151,9 +158,9 @@ int64_t getNonce(char* address)
};
cJSON *params = cJSON_CreateArray();
cJSON_AddItemToArray(params, cJSON_CreateString(address));
cJSON_AddItemToArray(params, cJSON_CreateString("pending"));
// cJSON_AddItemToArray(params, cJSON_CreateString("pending"));
int64_t nonce = -1;
cJSON *nonceJson = sendRpcRequest("eth_getTransactionCount", params);
cJSON *nonceJson = sendRpcRequest("parity_nextNonce", params);
cJSON_Delete(params);
if (nonceJson != NULL && is_cJSON_String(nonceJson) && nonceJson != NULL) {
nonce = (int64_t) strtol(nonceJson->valuestring, NULL, 0);

4
iguana/exchanges/etomicswap/etomiccurl.h

@ -12,10 +12,10 @@ extern "C"{
#endif
#ifdef ETOMIC_TESTNET
#define ETOMIC_URL "https://ropsten.infura.io/y07GHxUyTgeN2mdfOonu"
#define ETOMIC_URL "http://195.201.0.6:8545"
#define DEFAULT_GAS_PRICE 100
#else
#define ETOMIC_URL "https://mainnet.infura.io/y07GHxUyTgeN2mdfOonu"
#define ETOMIC_URL "http://195.201.0.6:8555"
#define DEFAULT_GAS_PRICE 4
#endif

Loading…
Cancel
Save