Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement management command 'sync_listener' #1645

Merged
merged 5 commits into from
Jul 9, 2018
Merged

Implement management command 'sync_listener' #1645

merged 5 commits into from
Jul 9, 2018

Conversation

pinkiebell
Copy link
Contributor

@pinkiebell pinkiebell commented Jul 7, 2018

It listens for new blocks that contain transactions to standard bounties(fulfillBounty), and processes those bounties instantly.

Example:
./manage.py sync_listener mainnet

Fixes #1605

It listens for new blocks that contain transactions to standard bounties(fulfillBounty), and processes those bounties instantly.

Example:
./manage.py sync_listener mainnet

Fixes 1605
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)

def process_bounty(bounty_id, network):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E302 expected 2 blank lines, found 1

bounty = get_bounty(bounty_id, network)
web3_process_bounty(bounty)

class Command(BaseCommand):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E302 expected 2 blank lines, found 1

@codecov
Copy link

codecov bot commented Jul 7, 2018

Codecov Report

Merging #1645 into master will decrease coverage by 0.12%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1645      +/-   ##
==========================================
- Coverage   29.49%   29.37%   -0.13%     
==========================================
  Files         132      133       +1     
  Lines        9870     9911      +41     
  Branches     1285     1289       +4     
==========================================
  Hits         2911     2911              
- Misses       6854     6895      +41     
  Partials      105      105
Impacted Files Coverage Δ
app/dashboard/management/commands/sync_listener.py 0% <0%> (ø)
app/retail/views.py 36.77% <0%> (-0.49%) ⬇️
app/retail/utils.py 15.12% <0%> (-0.08%) ⬇️
app/marketing/stats.py 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7baae3...f328c2a. Read the comment docs.

pinkiebell added 2 commits July 7, 2018 21:15
Continue the txs loop if getTransaction returns None
Style fixes.
@owocki
Copy link
Contributor

owocki commented Jul 9, 2018

i dont think this is working

root@e13ab5fdff58:/code/app# ./manage.py sync_listener mainnet
/usr/local/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
  """)
got new block 0xafc55769e4071b6b831edf1d6016782d3416376641c33116e7f88940c011e19e
got new block 0x2d8029c64e5bb6483762791eb5313648135aeab6cff1b1b68e315325707b9700
got new block 0xec3e021b0ac1e61bb250ba1aef4650dc98a185c9946abd58db7a0c0d1ef47f86
found a stdbounties tx
process_bounty 4957305349080171221489756848185353997596647363
got new block 0xa9fde9844b8b3df98833ad02ad74eaecd4ed64b6825bed6dabc7d807eb2cc6c4
got new block 0x9f82e864c47cedc6103126a786f54d35934968f3986d48a58317ca8f0a8f2080
got new block 0x649c48ccd9138c96779073cd6c3e4af6e6d460240379125a143dc436af642c49

4957305349080171221489756848185353997596647363 is not the correct bountyid , 737 is. maybe the bountyid needs to be decoded?!

@ghost ghost assigned owocki Jul 9, 2018
@ghost ghost added the in progress label Jul 9, 2018

print('found a stdbounties tx')
data = tx['input']
method_id = data[:10]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F841 local variable 'method_id' is assigned to but never used

print('found a stdbounties tx')
data = tx['input']
method_id = data[:10]
#if method_id != '0x1e688c14':

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '

print('found a stdbounties tx')
data = tx['input']
method_id = data[:10]
#if method_id != '0x1e688c14':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this work with every other method in stdbounties too?

@owocki
Copy link
Contributor

owocki commented Jul 9, 2018

f328c2a enables all methods

@owocki owocki merged commit 5515a3b into gitcoinco:master Jul 9, 2018
@ghost ghost removed the in progress label Jul 9, 2018
mbeacom added a commit that referenced this pull request Jul 9, 2018
@pinkiebell pinkiebell deleted the 1605 branch October 30, 2018 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants