From 19ec56b92310103ebe0e1f72e5e63913bdfb139b Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sun, 18 Oct 2015 12:23:21 +0200 Subject: [PATCH 1/8] fix: sign tx inputs with the new low s class --- lib/transaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/transaction.py b/lib/transaction.py index 42b51f2f0..fa4636f84 100644 --- a/lib/transaction.py +++ b/lib/transaction.py @@ -745,7 +745,7 @@ class Transaction: for_sig = Hash(self.tx_for_sig(i).decode('hex')) pkey = regenerate_key(sec) secexp = pkey.secret - private_key = ecdsa.SigningKey.from_secret_exponent( secexp, curve = SECP256k1 ) + private_key = bitcoin.MySigningKey.from_secret_exponent( secexp, curve = SECP256k1 ) public_key = private_key.get_verifying_key() sig = private_key.sign_digest_deterministic( for_sig, hashfunc=hashlib.sha256, sigencode = ecdsa.util.sigencode_der ) assert public_key.verify_digest( sig, for_sig, sigdecode = ecdsa.util.sigdecode_der) From fbda9dac79944451de6b5ab701b3d426c905114d Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sun, 18 Oct 2015 12:36:04 +0200 Subject: [PATCH 2/8] fix #1479 --- lib/wallet.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/wallet.py b/lib/wallet.py index 096bf2584..0fab120da 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -769,9 +769,11 @@ class Abstract_Wallet(PrintError): dd.pop(addr) else: dd[addr] = l - self.txi.pop(tx_hash) - self.txo.pop(tx_hash) - + try: + self.txi.pop(tx_hash) + self.txo.pop(tx_hash) + except KeyErrror: + self.print_error("tx was not in history", tx_hash) def receive_tx_callback(self, tx_hash, tx, tx_height): self.add_transaction(tx_hash, tx) From f8e51e332343097c88140978ab97345b00b3888c Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sun, 18 Oct 2015 12:43:20 +0200 Subject: [PATCH 3/8] remove themes, check python3 in setup.py --- MANIFEST.in | 5 +- gui/qt/themes/README | 12 ---- gui/qt/themes/cleanlook/name.cfg | 1 - gui/qt/themes/cleanlook/style.css | 62 ------------------ gui/qt/themes/dark/name.cfg | 1 - gui/qt/themes/dark/style.css | 35 ---------- gui/qt/themes/sahara/name.cfg | 1 - gui/qt/themes/sahara/style.css | 102 ------------------------------ setup.py | 17 ++--- 9 files changed, 7 insertions(+), 229 deletions(-) delete mode 100644 gui/qt/themes/README delete mode 100644 gui/qt/themes/cleanlook/name.cfg delete mode 100644 gui/qt/themes/cleanlook/style.css delete mode 100644 gui/qt/themes/dark/name.cfg delete mode 100644 gui/qt/themes/dark/style.css delete mode 100644 gui/qt/themes/sahara/name.cfg delete mode 100644 gui/qt/themes/sahara/style.css diff --git a/MANIFEST.in b/MANIFEST.in index d1d93bb12..4fa5491a6 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,5 @@ -include README LICENCE RELEASE-NOTES AUTHORS +include LICENCE RELEASE-NOTES AUTHORS +include README.rst include electrum.conf.sample include electrum.desktop include *.py @@ -12,4 +13,4 @@ include app.fil include icons.qrc recursive-include icons * recursive-include scripts * -recursive-include docs * + diff --git a/gui/qt/themes/README b/gui/qt/themes/README deleted file mode 100644 index 03254ac68..000000000 --- a/gui/qt/themes/README +++ /dev/null @@ -1,12 +0,0 @@ -To add a new theme, simply create a new directory in the electrum data directory (either ./data or your system wide local data). - -Inside your directory create a file called name.cfg with the name of that theme. - -Create another file called style.css - this will be your CSS for the theme (see other themes for reference). - -Documentation on Qt's stylesheets (used by Electrum): - -Overview: http://qt-project.org/doc/qt-4.8/stylesheet.html -Examples: http://qt-project.org/doc/qt-4.8/stylesheet-examples.html -Reference manual: http://doc.qt.nokia.com/4.7-snapshot/stylesheet-reference.html - diff --git a/gui/qt/themes/cleanlook/name.cfg b/gui/qt/themes/cleanlook/name.cfg deleted file mode 100644 index 475ba47b4..000000000 --- a/gui/qt/themes/cleanlook/name.cfg +++ /dev/null @@ -1 +0,0 @@ -Cleanlook diff --git a/gui/qt/themes/cleanlook/style.css b/gui/qt/themes/cleanlook/style.css deleted file mode 100644 index 888cbcf95..000000000 --- a/gui/qt/themes/cleanlook/style.css +++ /dev/null @@ -1,62 +0,0 @@ -#main_window -{ - background: qlineargradient(x1: 0, y1: 0, x2:0,y2:1, stop: 0 white , stop: 1 #E8E8E8); -} - -MiniWindow QPushButton { - color: #777; - border: 1px solid #CCC; - border-radius: 0px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 white, stop: 1 #E6E6E6); - min-height: 30px; - min-width: 30px; -} - -#send_button{ - color: #FFF; - border: 1px solid #3786E6; - border-radius: 4px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #72B2F8, stop: 1 #3484E6); - padding: 2px; - width: 20px; -} - -#send_button:disabled{ - color: #D3E8FE; - border: 1px solid #6DAEF7; - border-radius: 4px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #A5CFFA, stop: 1 #72B2F8); -} -#address_input, #amount_input, #label_input -{ - color: #000; - padding: 5px; - border-radius: 5px; - min-height: 23px; - border: 1px solid #AAA9A9; - width: 200px; -} - -#address_input[isValid=true] -{ - color: #4D9948; -} - -#address_input[isValid=false] -{ - color: #CE4141; -} - -#balance_label -{ - color: #333; -} - -#history -{ - color: #888; -} - diff --git a/gui/qt/themes/dark/name.cfg b/gui/qt/themes/dark/name.cfg deleted file mode 100644 index 4030549b1..000000000 --- a/gui/qt/themes/dark/name.cfg +++ /dev/null @@ -1 +0,0 @@ -Dark diff --git a/gui/qt/themes/dark/style.css b/gui/qt/themes/dark/style.css deleted file mode 100644 index c4554e637..000000000 --- a/gui/qt/themes/dark/style.css +++ /dev/null @@ -1,35 +0,0 @@ -#main_window -{ - background-image: url(:/icons/dark_background.png); -} - -#address_input[readOnly=true], #amount_input[readOnly=true] -{ - font: italic; - color: gray; -} -#address_input[readOnly=false], #amount_input[readOnly=false] -{ - font: normal; - color: black; -} - -#valid_address::indicator -{ - width: 24px; - height: 24px; -} -#valid_address::indicator:checked -{ - image: url(confirmed.png); -} -#valid_address::indicator:unchecked -{ - image: url(unconfirmed.png); -} - -#balance_label -{ - color: white; -} - diff --git a/gui/qt/themes/sahara/name.cfg b/gui/qt/themes/sahara/name.cfg deleted file mode 100644 index da4844db7..000000000 --- a/gui/qt/themes/sahara/name.cfg +++ /dev/null @@ -1 +0,0 @@ -Sahara diff --git a/gui/qt/themes/sahara/style.css b/gui/qt/themes/sahara/style.css deleted file mode 100644 index cd8d72728..000000000 --- a/gui/qt/themes/sahara/style.css +++ /dev/null @@ -1,102 +0,0 @@ -#main_window -{ - background: qlineargradient(x1: 0, y1: 0, x2:0,y2:1, stop: 0 white , stop: 1 #F2E3BE); -} - -MiniWindow QPushButton { - color: #C1A76D; - border: 1px solid #A7811C; - border-radius: 0px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 white, stop: 1 #F2E3BE); - min-height: 25px; - min-width: 30px; -} - -#send_button{ - color: #FEEBA7; - border: 1px solid #AD8B35; - border-radius: 4px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #E0A035, stop: 1 #AD8B35); - min-width: 80px; - min-height: 23px; - padding: 2px; -} - -#send_button:disabled{ - color: #FEEDD3; - border: 1px solid #F7D46D; - border-radius: 4px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #FAEEA5, stop: 1 #DBC050); - min-width: 80px; - min-height: 23px; - padding: 2px; -} - -#receive_button -{ - color: #FEEBA7; - border: 1px solid #AD8B35; - border-radius: 4px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #E0A035, stop: 1 #AD8B35); - min-height: 25px; - min-width: 30px; -} -#receive_button[isActive=true] -{ - color: #FEEBA7; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #E0A035, stop: 1 #987620); -} - -#address_input, #amount_input -{ - color: #000; - padding: 5px; - border-radius: 4px; - border: 1px solid #CBAE69; - width: 225px; -} - -#address_input[isValid=true] -{ - color: #4D9948; - padding: 5px; - border-radius: 4px; - border: 1px solid #CBAE69; - width: 225px; - margin-top: 4px; -} - -#address_input[isValid=false] -{ - color: #CE4141; - padding: 5px; - border-radius: 4px; - border: 1px solid #CBAE69; - width: 225px; - margin-top: 4px; -} - -#address_input[isValid=placeholder] -{ - color: #DEC58D; - padding: 5px; - border-radius: 4px; - border: 1px solid #CBAE69; - width: 225px; - margin-top: 4px; -} -#balance_label -{ - color: #7E5907; -} - -#history -{ - color: #8B6914; -} - diff --git a/setup.py b/setup.py index 8ad670c35..a7bd67c06 100644 --- a/setup.py +++ b/setup.py @@ -8,23 +8,22 @@ import sys import platform import imp - version = imp.load_source('version', 'lib/version.py') if sys.version_info[:3] < (2, 7, 0): sys.exit("Error: Electrum requires Python version >= 2.7.0...") - - +if sys.version_info[:3] >= (3, 0, 0): + sys.exit("Error: Electrum requires Python 2") data_files = [] -if platform.system() in [ 'Linux', 'FreeBSD', 'DragonFly']: + +if platform.system() in ['Linux', 'FreeBSD', 'DragonFly']: usr_share = os.path.join(sys.prefix, "share") data_files += [ (os.path.join(usr_share, 'applications/'), ['electrum.desktop']), (os.path.join(usr_share, 'pixmaps/'), ['icons/electrum.png']) ] - setup( name="Electrum", version=version.ELECTRUM_VERSION, @@ -48,14 +47,6 @@ setup( 'www/index.html', 'wordlist/*.txt', 'locale/*/LC_MESSAGES/electrum.mo', - ], - 'electrum_gui': [ - "qt/themes/cleanlook/name.cfg", - "qt/themes/cleanlook/style.css", - "qt/themes/sahara/name.cfg", - "qt/themes/sahara/style.css", - "qt/themes/dark/name.cfg", - "qt/themes/dark/style.css", ] }, scripts=['electrum'], From d318bd91ae59e8dd99db82933e0876e0f2459d73 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sun, 18 Oct 2015 12:48:53 +0200 Subject: [PATCH 4/8] enforce python2 in setup --- setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index a7bd67c06..79e19332b 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env/python2 # python setup.py sdist --format=zip,gztar @@ -12,8 +12,6 @@ version = imp.load_source('version', 'lib/version.py') if sys.version_info[:3] < (2, 7, 0): sys.exit("Error: Electrum requires Python version >= 2.7.0...") -if sys.version_info[:3] >= (3, 0, 0): - sys.exit("Error: Electrum requires Python 2") data_files = [] From e385fd283dba62912cdd81244499042f661e1fc4 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sun, 18 Oct 2015 12:52:38 +0200 Subject: [PATCH 5/8] version 2.5.1 --- RELEASE-NOTES | 7 +++++++ lib/version.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index cfa6f5870..0d7b9b1f8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,10 @@ +# Release 2.5.1 (bugfixes) + * signatures in transactions were still using the old class + * make sure that setup.py uses python2 + * fix wizard crash with trustedcoin plugin + * fix socket infinite loop + * fix history bug #1479 + # Release 2.5 * Low-S values are used in signatures (BIP 62). * The Kivy GUI has been merged into master. diff --git a/lib/version.py b/lib/version.py index c72e156a5..887effa59 100644 --- a/lib/version.py +++ b/lib/version.py @@ -1,4 +1,4 @@ -ELECTRUM_VERSION = '2.5' # version of the client package +ELECTRUM_VERSION = '2.5.1' # version of the client package PROTOCOL_VERSION = '0.10' # protocol version requested NEW_SEED_VERSION = 11 # electrum versions >= 2.0 OLD_SEED_VERSION = 4 # electrum versions < 2.0 From 47ae32a900e66a7feb683601ff27cd93c932c597 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sun, 18 Oct 2015 12:58:09 +0200 Subject: [PATCH 6/8] fix typo --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 79e19332b..7e0021732 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env/python2 +#!/usr/bin/env python2 # python setup.py sdist --format=zip,gztar From fc141cba289421a8349d2d68b4ffdfccf47d2a57 Mon Sep 17 00:00:00 2001 From: Chris Beaven Date: Mon, 19 Oct 2015 10:42:46 +1300 Subject: [PATCH 7/8] Fix KeyErrror typo --- lib/wallet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/wallet.py b/lib/wallet.py index 0fab120da..88a83ede9 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -772,7 +772,7 @@ class Abstract_Wallet(PrintError): try: self.txi.pop(tx_hash) self.txo.pop(tx_hash) - except KeyErrror: + except KeyError: self.print_error("tx was not in history", tx_hash) def receive_tx_callback(self, tx_hash, tx, tx_height): From 876a2c8ed03be4320c8894949bfb03b779fccd6a Mon Sep 17 00:00:00 2001 From: Chris Beaven Date: Mon, 19 Oct 2015 10:51:05 +1300 Subject: [PATCH 8/8] Missing sys import Also put the error message in sys.exit rather than printing. This will output it to stderr and make the exit code non-zero like it should be. --- lib/websockets.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/websockets.py b/lib/websockets.py index 8014ef25c..65c9ded9b 100644 --- a/lib/websockets.py +++ b/lib/websockets.py @@ -21,8 +21,8 @@ from collections import defaultdict try: from SimpleWebSocketServer import WebSocket, SimpleSSLWebSocketServer except ImportError: - print "install SimpleWebSocketServer" - sys.exit() + import sys + sys.exit("install SimpleWebSocketServer") import util @@ -93,7 +93,7 @@ class WsClientThread(util.DaemonThread): except Queue.Empty: continue id = r.get('id') - if id is None: + if id is None: method = r.get('method') params = r.get('params') else: