Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Fix awaiting incoming payments
Browse files Browse the repository at this point in the history
  • Loading branch information
Krigpl committed Jul 9, 2018
1 parent 9386952 commit 71e77dd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion golem/transactions/ethereum/ethereumincomeskeeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class EthereumIncomesKeeper(IncomesKeeper):
BLOCK_NUMBER_DB_KEY = 'eth_incomes_keeper_block_number'
BLOCK_NUMBER_DB_KEY = 'eth_incomes_keeper_block_number_v2'
BLOCK_NUMBER_BUFFER = 50

def __init__(self, sci) -> None:
Expand Down
3 changes: 2 additions & 1 deletion golem/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import semantic_version

from eth_utils import to_checksum_address
from ethereum.utils import sha3

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -69,7 +70,7 @@ def encode_hex(b):


def pubkeytoaddr(pubkey: str) -> str:
return '0x' + encode_hex(sha3(decode_hex(pubkey))[12:])
return to_checksum_address('0x' + encode_hex(sha3(decode_hex(pubkey))[12:]))


def tee_target(prefix, proc, input_stream, path, stream):
Expand Down
8 changes: 8 additions & 0 deletions tests/golem/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os
import unittest

from eth_utils import encode_hex, is_checksum_address
import faker
import semantic_version

Expand Down Expand Up @@ -46,3 +48,9 @@ def test_None(self):

def test_invalid(self):
self.assertFalse(utils.is_version_compatible(fake.word(), self.spec)) # noqa pylint: disable=no-member


def test_pubkeytoaddr():
pubkey = encode_hex(os.urandom(64))
addr = utils.pubkeytoaddr(pubkey)
assert is_checksum_address(addr)

0 comments on commit 71e77dd

Please sign in to comment.