Skip to content

Commit

Permalink
remove dateparser and all its deps
Browse files Browse the repository at this point in the history
  • Loading branch information
greenaddress committed Aug 22, 2017
1 parent f2db434 commit ea821d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
6 changes: 4 additions & 2 deletions garecovery/clargs.py
Expand Up @@ -7,7 +7,8 @@

# Define GreenAddress_T0 as the earliest possible GreenAddress UTXO
# This is used as the default value for scanning the blockchain
GreenAddress_T0 = "28 Feb 2014"
# 28 Feb 2014
GreenAddress_T0 = 1393545600

# Some defaults here make it easier for tests to override them
DEFAULT_SCAN_FROM = GreenAddress_T0
Expand Down Expand Up @@ -147,9 +148,10 @@ def get_args(argv):
help='When scanning for 2of3 transactions search this number of keys')
advanced_2of3.add_argument(
'--scan-from',
type=int,
dest='scan_from',
default=DEFAULT_SCAN_FROM,
help='Start scanning the blockchain for transactions from this date/time. '
help='Start scanning the blockchain for transactions from this timestamp. '
'Scanning the blockchain is slow so if you know your transactions were all after '
'a certain date you can speed it up by restricting the search range with this '
'option. Defaults to the inception time of GreenAddress. Pass 0 to scan the entire '
Expand Down
11 changes: 2 additions & 9 deletions garecovery/two_of_three.py
@@ -1,4 +1,3 @@
import dateparser
import decimal
import io
import logging
Expand Down Expand Up @@ -308,13 +307,7 @@ def scan_blockchain(self, keysets):
logging.debug("Connecting to bitcoinrpc to scan blockchain")
core = bitcoincore.Connection(clargs.args)

# Convert human-friendly datetime scan_from to utc timestamp
if clargs.args.scan_from == '0':
scan_from_timestamp = 0
else:
scan_from = dateparser.parse(clargs.args.scan_from)
scan_from_timestamp = int(time.mktime(scan_from.timetuple()))
logging.info("Scanning from '{}' = {}".format(clargs.args.scan_from, scan_from_timestamp))
logging.info("Scanning from '{}'".format(clargs.args.scan_from))
logging.warning('This step may take 10 minutes or more')

# Need to import our keysets into core so that it will recognise the
Expand All @@ -326,7 +319,7 @@ def scan_blockchain(self, keysets):
addresses.append(witness.address)
requests.append({
'scriptPubKey': {"address": witness.address},
'timestamp': scan_from_timestamp,
'timestamp': clargs.args.scan_from,
'watchonly': True,
})
logging.info('Importing {} derived addresses into bitcoind'.format(len(requests)))
Expand Down
7 changes: 0 additions & 7 deletions tools/requirements.txt
@@ -1,6 +1,5 @@
argcomplete==1.8.2 --hash=sha256:c2a0a88492c31a42dde41636fbd4c406cde78fe7fb938ab511b733bff6358782
coverage==4.4.1 --hash=sha256:381be5d31d3f0d912334cf2c159bc7bea6bfe6b0e3df6061a3bf2bf88359b1f6 --hash=sha256:700040c354f0230287906b1276635552a3def4b646e0145555bc9e2e5da9e365 --hash=sha256:0f1883eab9c19aa243f51308751b8a2a547b9b817b721cc0ecf3efb99fafbea7 --hash=sha256:c820a533a943ebc860acc0ce6a00dd36e0fdf2c6f619ff8225755169428c5fa2 --hash=sha256:7a9c44400ee0f3b4546066e0710e1250fd75831adc02ab99dda176ad8726f424
dateparser==0.6.0 --hash=sha256:e2629d2f8361722c6047138ca085256c9f2cf5cc657fd66122aa0564afa4dc33
funcsigs==1.0.2 --hash=sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca
mock==2.0.0 --hash=sha256:5ce3c71c5545b472da17b72268978914d0252980348636840bd34a00b5cc96c1
pbr==3.1.1 --hash=sha256:60c25b7dfd054ef9bb0ae327af949dd4676aa09ac3a9471cdc871d8a9213f9ac
Expand All @@ -10,15 +9,9 @@ pycoin==0.77 --hash=sha256:c5e2fe86690e72b63000f4cf363851116cb7b96e8eb77b69b710e
pytest==3.1.3 --hash=sha256:2a4f483468954621fcc8f74784f3b42531e5b5008d49fc609b37bc4dbc6dead1
pytest-cov==2.5.1 --hash=sha256:890fe5565400902b0c78b5357004aab1c814115894f4f21370e2433256a3eeec
python-bitcoinrpc==1.0 --hash=sha256:a6a6f35672635163bc491c25fe29520bdd063dedbeda3b37bf5be97aa038c6e7
python-dateutil==2.6.1 --hash=sha256:95511bae634d69bc7329ba55e646499a842bc4ec342ad54a8cdb65645a0aad3c
pytz==2017.2 --hash=sha256:d1d6729c85acea5423671382868627129432fba9a89ecbb248d8d1c7a9f01c67
regex==2017.7.26 --hash=sha256:b0e0c1c80e677ee351d14bdb0345c33caab6acdbaf3a41c3f34c09bbb68c8897
ruamel.ordereddict==0.4.13; python_version <= '2.7' --hash=sha256:45541836cbfdde630033cae7bbbe35acbac87a0ceec79f944b7a3bedd940fe78 --hash=sha256:bf0a198c8ce5d973c24e5dba12d3abc254996788ca6ad8448eabc6aa710db149
ruamel.yaml==0.15.22 --hash=sha256:136a1f53a9e860f931b11bbec2b0288b510e419fea030c8780a9ec3727a07176 --hash=sha256:c7754abb5face9ccb52308cb9c42f96c37af74ba2bf074d69c7895c5e2357744 --hash=sha256:63247356595fdecc27f2fc517e370d1f2a911fbc58ca544ee93f13337311d017
setuptools-git==1.2 --hash=sha256:e7764dccce7d97b4b5a330d7b966aac6f9ac026385743fd6cedad553f2494cfa
setuptools-pep8==0.9.0 --hash=sha256:f620cd7494015729249bda7260c9b94900d6e6ab27df46051fb144c32627080c
six==1.10.0 --hash=sha256:0ff78c403d9bccf5a425a6d31a12aa6b47f1c21ca4dc2573a7e2f32a97335eb1
tzlocal==1.4 --hash=sha256:05a2908f7fb1ba8843f03b2360d6ad314dbf2bce4644feb702ccd38527e13059

https://github.com/ElementsProject/libwally-core/releases/download/release_0.4.0/wallycore-0.4.0-cp27-cp27mu-linux_x86_64.whl; 'linux' in sys_platform and python_version == '2.7' and platform_machine == 'x86_64' --hash=sha256:d692be12dbfc2447a92028784a166b1c60162c59ecd1059a886b7a45ab4eae00
https://github.com/ElementsProject/libwally-core/releases/download/release_0.4.0/wallycore-0.4.0-cp35-cp35m-linux_x86_64.whl; 'linux' in sys_platform and python_version == '3.5' and platform_machine == 'x86_64' --hash=sha256:58726a4c1cda61191376f99753ed79445bc31408eca4d83b4156795885c5c6d2
Expand Down

0 comments on commit ea821d9

Please sign in to comment.