Skip to content

Commit

Permalink
Some more adjustments to mitigate the latest Ethereum network issues …
Browse files Browse the repository at this point in the history
…when distribution tokens.
  • Loading branch information
miohtama committed Jan 5, 2018
1 parent cd2d01b commit 66bf8ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ico/cmd/distributetokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,13 @@ def main(chain, address, token, csv_file, limit, start_from, issuer_address, add

transaction = {
"from": address,
"gasPrice": gas_price
"gasPrice": gas_price,
"gas": 100000, # Use 100k limit
}

tokens = int(tokens)

print("Row", i, "giving", tokens, "to", addr, "issuer", issuer.address, "time passed", time.time() - start_time, "ETH passed", spent)
print("Row", i, "giving", tokens, "to", addr, "issuer", issuer.address, "time passed", time.time() - start_time, "ETH passed", spent, "gas price", transaction["gasPrice"] / (10**9))

if issuer.call().issued(addr):
print("Already issued, skipping")
Expand Down
6 changes: 6 additions & 0 deletions ico/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from decimal import Decimal

import time
import web3
from eth_utils import add_0x_prefix
from ethereum.chain import Chain
Expand Down Expand Up @@ -46,6 +47,11 @@ def check_succesful_tx(web3: Web3, txid: str, timeout=600) -> dict:
# http://ethereum.stackexchange.com/q/6007/620
receipt = wait_for_transaction_receipt(web3, txid, timeout=timeout)
txinfo = web3.eth.getTransaction(txid)
if not txinfo:
# This is some sort of geth flakiness issue, not sure what
# Try to mitigate it with timeout
time.sleep(1.0)
txinfo = web3.eth.getTransaction(txid)

if receipt is None:
raise RuntimeError("Did not get receipt for {}".format(txid))
Expand Down

0 comments on commit 66bf8ab

Please sign in to comment.