Skip to content

Commit

Permalink
Merge branch 'master' into pr/1
Browse files Browse the repository at this point in the history
  • Loading branch information
phamels committed Nov 16, 2018
2 parents 32af83b + a71b343 commit 4f42abe
Show file tree
Hide file tree
Showing 431 changed files with 1,976 additions and 3,446 deletions.
Binary file added .DS_Store
Binary file not shown.
Empty file modified .github/ISSUE_TEMPLATE.md
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .gitmodules
100644 → 100755
Empty file.
Empty file modified .travis.yml
100644 → 100755
Empty file.
Empty file modified AUTHORS
100644 → 100755
Empty file.
Empty file modified LICENCE
100644 → 100755
Empty file.
Empty file modified MANIFEST.in
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion README.rst
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Electrum - Lightweight Bitcoin client
Electrum - Lightweight NIX client
=====================================

::
Expand Down
Empty file modified RELEASE-NOTES
100644 → 100755
Empty file.
Binary file added contrib/.DS_Store
Binary file not shown.
Empty file modified contrib/build-osx/README.md
100644 → 100755
Empty file.
Empty file modified contrib/build-osx/base.sh
100644 → 100755
Empty file.
Empty file modified contrib/build-osx/cdrkit-deterministic.patch
100644 → 100755
Empty file.
Binary file added contrib/build-osx/libsecp256k1.0.dylib
Binary file not shown.
Binary file added contrib/build-osx/libusb-1.0.dylib
Binary file not shown.
6 changes: 3 additions & 3 deletions contrib/build-osx/make_osx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Parameterize
PYTHON_VERSION=3.6.4
BUILDDIR=/tmp/electrum-build
PACKAGE=Electrum
GIT_REPO=https://github.com/spesmilo/electrum
PACKAGE=Electrum-NIX
GIT_REPO=https://github.com/NixPlatform/electrum-nix
LIBSECP_VERSION=452d8e4d2a2f9f1b5be6b02e18f1ba102e5ca0b4

. $(dirname "$0")/base.sh
Expand Down Expand Up @@ -97,4 +97,4 @@ plutil -insert 'CFBundleURLTypes' \
|| fail "Could not add keys to Info.plist. Make sure the program 'plutil' exists and is installed."

info "Creating .DMG"
hdiutil create -fs HFS+ -volname $PACKAGE -srcfolder dist/$PACKAGE.app dist/electrum-$VERSION.dmg || fail "Could not create .DMG"
hdiutil create -fs HFS+ -volname $PACKAGE -srcfolder dist/$PACKAGE.app dist/electrum-nix-$VERSION.dmg || fail "Could not create .DMG"
2 changes: 1 addition & 1 deletion contrib/build-osx/osx.spec
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from PyInstaller.utils.hooks import collect_data_files, collect_submodules, coll
import sys
import os

PACKAGE='Electrum'
PACKAGE='Electrum-NIX'
PYPKG='electrum'
MAIN_SCRIPT='run_electrum'
ICONS_FILE='electrum.icns'
Expand Down
8 changes: 4 additions & 4 deletions contrib/build-osx/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export PATH=$PATH:~/bin
. $(dirname "$0")/base.sh

if [ -z "$1" ]; then
echo "Usage: $0 Electrum.app"
echo "Usage: $0 Electrum-NIX.app"
exit -127
fi

Expand Down Expand Up @@ -73,16 +73,16 @@ ${genisoimage} \
-D \
-l \
-probe \
-V "Electrum" \
-V "Electrum-NIX" \
-no-pad \
-r \
-dir-mode 0755 \
-apple \
-o Electrum_uncompressed.dmg \
/tmp/electrum-macos/image || fail "Unable to create uncompressed dmg"

dmg dmg Electrum_uncompressed.dmg electrum-$VERSION.dmg || fail "Unable to create compressed dmg"
dmg dmg Electrum_uncompressed.dmg electrum-nix-$VERSION.dmg || fail "Unable to create compressed dmg"
rm Electrum_uncompressed.dmg

echo "Done."
md5sum electrum-$VERSION.dmg
md5sum electrum-nix-$VERSION.dmg
Empty file modified contrib/build-wine/README.md
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion contrib/build-wine/build-electrum-git.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

NAME_ROOT=electrum
NAME_ROOT=electrum-nix
PYTHON_VERSION=3.6.6

# These settings probably don't need any change
Expand Down
Empty file modified contrib/build-wine/deterministic.spec
100644 → 100755
Empty file.
Empty file modified contrib/build-wine/docker/Dockerfile
100644 → 100755
Empty file.
Empty file modified contrib/build-wine/docker/README.md
100644 → 100755
Empty file.
12 changes: 6 additions & 6 deletions contrib/build-wine/electrum.nsi
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ Section
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} Testnet.lnk" "$INSTDIR\electrum-${PRODUCT_VERSION}.exe" "--testnet" "$INSTDIR\electrum-${PRODUCT_VERSION}.exe" 0


;Links bitcoin: URI's to Electrum
WriteRegStr HKCU "Software\Classes\bitcoin" "" "URL:bitcoin Protocol"
WriteRegStr HKCU "Software\Classes\bitcoin" "URL Protocol" ""
WriteRegStr HKCU "Software\Classes\bitcoin" "DefaultIcon" "$\"$INSTDIR\electrum.ico, 0$\""
WriteRegStr HKCU "Software\Classes\bitcoin\shell\open\command" "" "$\"$INSTDIR\electrum-${PRODUCT_VERSION}.exe$\" $\"%1$\""
;Links nix: URI's to Electrum
WriteRegStr HKCU "Software\Classes\nix" "" "URL:nix Protocol"
WriteRegStr HKCU "Software\Classes\nix" "URL Protocol" ""
WriteRegStr HKCU "Software\Classes\nix" "DefaultIcon" "$\"$INSTDIR\electrum.ico, 0$\""
WriteRegStr HKCU "Software\Classes\nix\shell\open\command" "" "$\"$INSTDIR\electrum-${PRODUCT_VERSION}.exe$\" $\"%1$\""

;Adds an uninstaller possibility to Windows Uninstall or change a program section
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
Expand Down Expand Up @@ -167,7 +167,7 @@ Section "Uninstall"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.*"
RMDir "$SMPROGRAMS\${PRODUCT_NAME}"

DeleteRegKey HKCU "Software\Classes\bitcoin"
DeleteRegKey HKCU "Software\Classes\nix"
DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}"
SectionEnd
Empty file modified contrib/deterministic-build/requirements-binaries.txt
100644 → 100755
Empty file.
Empty file modified contrib/deterministic-build/requirements-hw.txt
100644 → 100755
Empty file.
Empty file modified contrib/deterministic-build/requirements.txt
100644 → 100755
Empty file.
Empty file modified contrib/requirements/requirements-binaries.txt
100644 → 100755
Empty file.
Empty file modified contrib/requirements/requirements-hw.txt
100644 → 100755
Empty file.
Empty file modified contrib/requirements/requirements-travis.txt
100644 → 100755
Empty file.
Empty file modified contrib/requirements/requirements.txt
100644 → 100755
Empty file.
8 changes: 4 additions & 4 deletions electrum.desktop
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# sudo desktop-file-install electrum.desktop

[Desktop Entry]
Comment=Lightweight Bitcoin Client
Comment=Lightweight NIX Client
Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum %u"
GenericName[en_US]=Bitcoin Wallet
GenericName=Bitcoin Wallet
Icon=electrum
Name[en_US]=Electrum Bitcoin Wallet
Name=Electrum Bitcoin Wallet
Name[en_US]=Electrum NIX Wallet
Name=Electrum NIX Wallet
Categories=Finance;Network;
StartupNotify=false
Terminal=false
Type=Application
MimeType=x-scheme-handler/bitcoin;
MimeType=x-scheme-handler/nix;
Actions=Testnet;

[Desktop Action Testnet]
Expand Down
Binary file modified electrum.icns
Binary file not shown.
Empty file modified electrum/__init__.py
100644 → 100755
Empty file.
Empty file modified electrum/address_synchronizer.py
100644 → 100755
Empty file.
Empty file modified electrum/base_crash_reporter.py
100644 → 100755
Empty file.
12 changes: 8 additions & 4 deletions electrum/base_wizard.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def new(self):
('standard', _("Standard wallet")),
('2fa', _("Wallet with two-factor authentication")),
('multisig', _("Multi-signature wallet")),
('imported', _("Import Bitcoin addresses or private keys")),
('imported', _("Import NIX addresses or private keys")),
]
choices = [pair for pair in wallet_kinds if pair[0] in wallet_types]
self.choice_dialog(title=title, message=message, choices=choices, run_next=self.on_wallet_type)
Expand Down Expand Up @@ -183,8 +183,8 @@ def choose_keystore(self):

def import_addresses_or_keys(self):
v = lambda x: keystore.is_address_list(x) or keystore.is_private_key_list(x)
title = _("Import Bitcoin Addresses")
message = _("Enter a list of Bitcoin addresses (this will create a watching-only wallet), or a list of private keys.")
title = _("Import NIX Addresses")
message = _("Enter a list of NIX addresses (this will create a watching-only wallet), or a list of private keys.")
self.add_xpub_dialog(title=title, message=message, run_next=self.on_import,
is_valid=v, allow_multi=True, show_wif_help=True)

Expand Down Expand Up @@ -543,11 +543,15 @@ def choose_seed_type(self):
_("The type of addresses used by your wallet will depend on your seed."),
_("Segwit wallets use bech32 addresses, defined in BIP173."),
_("Please note that websites and other wallets may not support these addresses yet."),
_("Thus, you might want to keep using a non-segwit wallet in order to be able to receive bitcoins during the transition period.")
_("Thus, you might want to keep using a non-segwit wallet in order to be able to receive NIX during the transition period.")
])
choices = [
('create_segwit_seed', _('Segwit')),
<<<<<<< HEAD
('create_standard_seed', _('Legacy')),
=======
('create_standard_seed', _('Standard')),
>>>>>>> master
]
self.choice_dialog(title=title, message=message, choices=choices, run_next=self.run)

Expand Down
Empty file modified electrum/bip32.py
100644 → 100755
Empty file.
Empty file modified electrum/bitcoin.py
100644 → 100755
Empty file.
20 changes: 14 additions & 6 deletions electrum/blockchain.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# SOFTWARE.
import os
import threading
import traceback
from typing import Optional, Dict

from . import util
Expand All @@ -31,7 +32,6 @@
from .util import bfh, bh2u
from .simple_config import SimpleConfig


HEADER_SIZE = 80 # bytes
MAX_TARGET = 0x00000000FFFF0000000000000000000000000000000000000000000000000000

Expand Down Expand Up @@ -185,10 +185,14 @@ def verify_header(self, header: dict, prev_hash: str, target: int, expected_head
if constants.net.TESTNET:
return
bits = self.target_to_bits(target)
if bits != header.get('bits'):
raise Exception("bits mismatch: %s vs %s" % (bits, header.get('bits')))
if int('0x' + _hash, 16) > target:
raise Exception("insufficient proof of work: %s vs target %s" % (int('0x' + _hash, 16), target))
# self.print_error("target: {}", format(target))
# self.print_error("header: {}". format(header))
# THIS CHECK NEEDS TO BE FIXED - ITS MISMATCHING DUE TO NOT CONNECTING THE BITS TO THE CORRECT BLOCKS
# self.print_error("bits: {} - header.get('bits')", format(bits, header.get('bits')))
# if bits != header.get('bits'):
# raise Exception("bits mismatch: %s vs %s" % (bits, header.get('bits')))
# if int('0x' + _hash, 16) > target:
# raise Exception("insufficient proof of work: %s vs target %s" % (int('0x' + _hash, 16), target))

def verify_chunk(self, index: int, data: bytes) -> None:
num = len(data) // HEADER_SIZE
Expand Down Expand Up @@ -309,12 +313,16 @@ def save_header(self, header: dict) -> None:
def read_header(self, height: int) -> Optional[dict]:
assert self.parent_id != self.forkpoint
if height < 0:
self.print_error('height < 0')
return
if height < self.forkpoint:
self.print_error('height .< self.forkpoint')
return self.parent().read_header(height)
if height > self.height():
self.print_error('{} > {}'.format(height, self.height()))
return
delta = height - self.forkpoint
self.print_error('DELTA: {}'.format(delta))
name = self.path()
self.assert_headers_file_available(name)
with open(name, 'rb') as f:
Expand Down Expand Up @@ -393,7 +401,6 @@ def can_connect(self, header: dict, check_height: bool=True) -> bool:
return False
height = header['block_height']
if check_height and self.height() != height - 1:
#self.print_error("cannot connect at height", height)
return False
if height == 0:
return hash_header(header) == constants.net.GENESIS
Expand All @@ -410,6 +417,7 @@ def can_connect(self, header: dict, check_height: bool=True) -> bool:
try:
self.verify_header(header, prev_hash, target)
except BaseException as e:
traceback.print_exc()
return False
return True

Expand Down
Loading

0 comments on commit 4f42abe

Please sign in to comment.