Skip to content

Commit

Permalink
Merge pull request #732 from CounterpartyXCP/hotfix
Browse files Browse the repository at this point in the history
HOTFIX: Check maximum quantity also for invalid `send`
  • Loading branch information
adamkrellenstein committed Mar 18, 2015
2 parents c900fde + 6acb831 commit 44e138e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 54 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Client Versions ##
* v9.50.0 (2014-03-18)
* hotfix: global integer overflow
* v9.49.4 (2014-02-05)
* reconceived this package as a libary
* moved CLI to new repository: `counterparty-cli`
Expand Down
4 changes: 2 additions & 2 deletions counterpartylib/lib/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ def software_version():
logger.debug('Checking version.')

try:
host = 'https://counterpartyxcp.github.io/counterparty-lib/protocol_changes.json'
host = 'https://counterpartyxcp.github.io/counterparty-lib/counterpartylib/protocol_changes.json'
response = requests.get(host, headers={'cache-control': 'no-cache'})
# TODO: Temporary
if response.status_code != 200:
host = 'https://counterpartyxcp.github.io/counterpartyd/protocol_changes.json' # Old Location
host = 'https://counterpartyxcp.github.io/counterpartyd/counterpartylib/protocol_changes.json' # Old Location
response = requests.get(host, headers={'cache-control': 'no-cache'})
versions = json.loads(response.text)
except (requests.exceptions.ConnectionError, ConnectionRefusedError, ValueError):
Expand Down
4 changes: 2 additions & 2 deletions counterpartylib/lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

# Versions
VERSION_MAJOR = 9
VERSION_MINOR = 49
VERSION_REVISION = 4
VERSION_MINOR = 50
VERSION_REVISION = 0
VERSION_STRING = str(VERSION_MAJOR) + '.' + str(VERSION_MINOR) + '.' + str(VERSION_REVISION)


Expand Down
6 changes: 4 additions & 2 deletions counterpartylib/lib/messages/versions/send1.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ def parse (db, tx, message):
elif balances[0]['quantity'] < quantity:
quantity = min(balances[0]['quantity'], quantity)

if status == 'valid':
# For SQLite3
# For SQLite3
if quantity:
quantity = min(quantity, config.MAX_INT)

if status == 'valid':
problems = validate(db, tx['source'], tx['destination'], asset, quantity, tx['block_index'])
if problems: status = 'invalid: ' + '; '.join(problems)

Expand Down
7 changes: 7 additions & 0 deletions counterpartylib/protocol_changes.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,12 @@
"minimum_version_minor": 49,
"minimum_version_revision": 0,
"block_index": 334000
},
"hotfix_integer_overflow": {
"minimum_version_major": 9,
"minimum_version_minor": 50,
"minimum_version_revision": 0,
"block_index": 0
}

}
39 changes: 0 additions & 39 deletions protocol_changes.json

This file was deleted.

5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import sys
import shutil

CURRENT_VERSION = '9.49.4'
from counterpartylib.lib import config

CURRENT_VERSION = config.VERSION_STRING

# NOTE: Why we don’t use the the PyPi package:
# <https://code.google.com/p/apsw/source/detail?r=358a9623d051>
Expand Down Expand Up @@ -98,7 +100,6 @@ def finalize_options(self):

def run(self):
import appdirs
from counterpartylib.lib import config

old_data_dir = appdirs.user_config_dir(appauthor='Counterparty', appname='counterpartyd', roaming=True)
old_database = os.path.join(old_data_dir, 'counterpartyd.9.db')
Expand Down
7 changes: 0 additions & 7 deletions version.json

This file was deleted.

0 comments on commit 44e138e

Please sign in to comment.