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

[Backport] 4.1.0 backports #1602

Merged
merged 47 commits into from May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
93929a2
[GUI] Don't log to console by default.
furszy Apr 14, 2020
0a9fa8d
[GUI] Add more room to contacts dropdown
random-zebra Mar 17, 2020
6f81368
[GUI] Dark theme, inactive icons color fix.
furszy Mar 18, 2020
b2701cc
[GUI] Warn about change address not belonging to the wallet.
furszy Apr 14, 2020
22e0a1f
[Trivial] Fix warning in mousePressEvent.
furszy Apr 14, 2020
0e45518
[Trivial] jump line after function styling.
furszy Apr 14, 2020
05ffd66
[Build] Disable apt-cacher for Windows WSL gitian setup
Fuzzbawls Apr 15, 2020
1dd592a
[Qt] Don't translate dummy strings in mnrow
Fuzzbawls Apr 15, 2020
28300e6
Update seed scripts from upstream
Fuzzbawls Apr 19, 2020
16bf3f3
Update hard coded seeds
Fuzzbawls Apr 19, 2020
4a9f6c1
BugFix: cleanup invalid IsMasternodeReward method in OutPoint primitive.
furszy Apr 16, 2020
c3a1611
[QA] Avoid printing to console during cache creation
random-zebra Apr 22, 2020
d352817
[GUI][Bug] MnWizard: Fix validators for masternode alias and port
random-zebra Apr 20, 2020
9599424
[GUI] MnWizard: validate IP
random-zebra Apr 21, 2020
48a9113
[GUI] CoinControl: mark delegated after setting checked state
random-zebra Apr 20, 2020
d4247b0
[GUI] CoinControlDialog remove duplicate esc button
furszy Apr 24, 2020
8b5dcf0
[Doc] Note that v3 onion addresses are not supported
Fuzzbawls Apr 26, 2020
08db3df
[Bug][GUI] Send: Deactivate btnChangeAddress only when addr is not set
random-zebra Apr 23, 2020
5709870
[GUI] Reset change address from within SendChangeAddressDialog
random-zebra Apr 23, 2020
6fc725e
[UX] SendChangeAddressDialog: validate address on save
random-zebra Apr 24, 2020
b4e40a4
[Bug][Wallet] Fix CWallet::GetMinimumFee improperly set to feePerKb
random-zebra Apr 26, 2020
7968c6d
[Bug] Fix nTimeSmart computation
random-zebra Apr 25, 2020
da90bf4
[Cleanup] Remove unneeded GetComputedTxTime
random-zebra Apr 25, 2020
f7ddff0
[Refactor] Encapsulate ComputeTimeSmart in CWalletTx
random-zebra Apr 25, 2020
fa9a688
[GUI] Update the record time when wtx.nTimeSmart changes
random-zebra Apr 27, 2020
f849742
[Trivial] CustomFeeDialog: brace on newline
random-zebra Apr 26, 2020
a0a9fe7
[BUG] CustomFeeDialog: proper reset on clearAll
random-zebra Apr 26, 2020
abc09b1
[GUI] Hide MultiSend in the options
random-zebra Apr 26, 2020
e0e6ad2
[RPC] Disable/Hide multisend
random-zebra Apr 26, 2020
bcd2461
[Trivial] Hide CWallet::MultiSend() call in main
random-zebra Apr 27, 2020
908413d
[Cleanup][GUI] remove unneeded loop in decomposeTransaction
random-zebra Apr 27, 2020
0a15bba
[Qt] fix transaction details output-index to reflect vout index
random-zebra Apr 27, 2020
00a3590
[QA][Bug] Shorter wallet_basic.py functional test
random-zebra Apr 27, 2020
d0a9274
[GUI] Do not create new SettingsMultisendWidget
furszy Apr 29, 2020
15c5ddb
[GUI] SendCustomFeeDialog: prevent user from saving insane fees
random-zebra Apr 26, 2020
da791e0
[GUI] Custom fee, min amount validation.
furszy Apr 28, 2020
9ed3b99
[Trivial] Fix wording: "must be above" to "must be at least"
random-zebra Apr 28, 2020
9ae6b2e
Update copyright headers for files changed in 2020
Fuzzbawls Apr 30, 2020
f65d370
[GUI] Reconnect CS owner address edit-label action
Fuzzbawls May 3, 2020
c379e4b
Removing warrows.dev dead seeder
furszy May 2, 2020
1f652be
[GUI][Bug] Fix "Select all" / "Unselect all" logic in coincontrol
random-zebra May 3, 2020
512708b
[GUI] Update translations from Transifex for 4.1
Fuzzbawls May 2, 2020
e15062a
BugFix invalid language mapping.
furszy May 5, 2020
977d2ce
BugFix welcome wizard not storing & loading the selected language.
furszy May 5, 2020
6fc5a2d
[GUI] Re translate welcome wizard on every language selection.
furszy May 5, 2020
323ba4e
[GUI][Bug] Fix editing of CS address labels
Fuzzbawls May 1, 2020
b97530a
[GUI][Bug] Don't clear address label during send address validation
Fuzzbawls May 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .tx/config
@@ -1,7 +1,7 @@
[main]
host = https://www.transifex.com

[pivx-project-translations.qt-translation-40x]
[pivx-project-translations.qt-translation-41x]
file_filter = src/qt/locale/pivx_<lang>.ts
source_file = src/qt/locale/pivx_en.ts
source_lang = en
7 changes: 5 additions & 2 deletions contrib/gitian-build.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# Copyright (c) 2018-2019 The Bitcoin Core developers
# Copyright (c) 2019 The PIVX developers
# Copyright (c) 2019-2020 The PIVX developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down Expand Up @@ -120,7 +120,7 @@ def setup_repos():
if args.host_os == 'darwin':
subprocess.check_call(['sed', '-i.old', '/50cacher/d', 'bin/make-base-vm'])
if args.host_os == 'linux':
if args.is_fedora or args.is_centos:
if args.is_fedora or args.is_centos or args.is_wsl:
subprocess.check_call(['sed', '-i', '/50cacher/d', 'bin/make-base-vm'])
subprocess.check_call(make_image_prog)
subprocess.check_call(['git', 'checkout', 'bin/make-base-vm'])
Expand Down Expand Up @@ -288,12 +288,15 @@ def main():
args.is_bionic = False
args.is_fedora = False
args.is_centos = False
args.is_wsl = False
if os.path.isfile('/usr/bin/lsb_release'):
args.is_bionic = b'bionic' in subprocess.check_output(['lsb_release', '-cs'])
if os.path.isfile('/etc/fedora-release'):
args.is_fedora = True
if os.path.isfile('/etc/centos-release'):
args.is_centos = True
if os.path.isfile('/proc/version') and open('/proc/version', 'r').read().find('Microsoft'):
args.is_wsl = True

if args.kvm and args.docker:
raise Exception('Error: cannot have both kvm and docker')
Expand Down
15 changes: 8 additions & 7 deletions contrib/seeds/generate-seeds.py
Expand Up @@ -34,7 +34,8 @@

from base64 import b32decode
from binascii import a2b_hex
import sys, os
import sys
import os
import re

# ipv4 in ipv6 prefix
Expand All @@ -46,7 +47,7 @@ def name_to_ipv6(addr):
if len(addr)>6 and addr.endswith('.onion'):
vchAddr = b32decode(addr[0:-6], True)
if len(vchAddr) != 16-len(pchOnionCat):
raise ValueError('Invalid onion %s' % s)
raise ValueError('Invalid onion %s' % vchAddr)
return pchOnionCat + vchAddr
elif '.' in addr: # IPv4
return pchIPv4 + bytearray((int(x) for x in addr.split('.')))
Expand All @@ -73,7 +74,7 @@ def name_to_ipv6(addr):
raise ValueError('Could not parse address %s' % addr)

def parse_spec(s, defaultport):
match = re.match('\[([0-9a-fA-F:]+)\](?::([0-9]+))?$', s)
match = re.match(r'\[([0-9a-fA-F:]+)\](?::([0-9]+))?$', s)
if match: # ipv6
host = match.group(1)
port = match.group(2)
Expand Down Expand Up @@ -114,7 +115,7 @@ def process_nodes(g, f, structname, defaultport):
def main():
if len(sys.argv)<2:
print(('Usage: %s <path_to_nodes_txt>' % sys.argv[0]), file=sys.stderr)
exit(1)
sys.exit(1)
g = sys.stdout
indir = sys.argv[1]
g.write('#ifndef BITCOIN_CHAINPARAMSSEEDS_H\n')
Expand All @@ -124,12 +125,12 @@ def main():
g.write(' * AUTOGENERATED by contrib/seeds/generate-seeds.py\n')
g.write(' *\n')
g.write(' * Each line contains a 16-byte IPv6 address and a port.\n')
g.write(' * IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.\n')
g.write(' * IPv4 as well as onion addresses are wrapped inside an IPv6 address accordingly.\n')
g.write(' */\n')
with open(os.path.join(indir,'nodes_main.txt'),'r') as f:
with open(os.path.join(indir,'nodes_main.txt'), 'r', encoding="utf8") as f:
process_nodes(g, f, 'pnSeed6_main', 51472)
g.write('\n')
with open(os.path.join(indir,'nodes_test.txt'),'r') as f:
with open(os.path.join(indir,'nodes_test.txt'), 'r', encoding="utf8") as f:
process_nodes(g, f, 'pnSeed6_test', 51474)
g.write('#endif // BITCOIN_CHAINPARAMSSEEDS_H\n')

Expand Down
136 changes: 95 additions & 41 deletions contrib/seeds/makeseeds.py
@@ -1,32 +1,36 @@
#!/usr/bin/env python3
# Copyright (c) 2013-2017 The Bitcoin Core developers
# Copyright (c) 2013-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Generate seeds.txt from Pieter's DNS seeder
#

import re
import sys
import dns.resolver
import collections

NSEEDS=512

MAX_SEEDS_PER_ASN=2
MAX_SEEDS_PER_ASN=4

MIN_BLOCKS = 615801
MIN_BLOCKS = 1530000

# These are hosts that have been observed to be behaving strangely (e.g.
# aggressively connecting to every node).
SUSPICIOUS_HOSTS = {
""
}
with open("suspicious_hosts.txt", mode="r", encoding="utf-8") as f:
SUSPICIOUS_HOSTS = {s.strip() for s in f if s.strip()}

import re
import sys
import dns.resolver
import collections

PATTERN_IPV4 = re.compile(r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})):(\d+)$")
PATTERN_IPV6 = re.compile(r"^\[([0-9a-z:]+)\]:(\d+)$")
PATTERN_ONION = re.compile(r"^([abcdefghijklmnopqrstuvwxyz234567]{16}\.onion):(\d+)$")
PATTERN_AGENT = re.compile(r"^(/PIVXCore:2.2.(0|1|99)/)$")
PATTERN_AGENT = re.compile(
r"^/PIVXCore:("
r"4.0.(0|1|2|99|99.1|99.2)|"
r"4.1.(0|99)"
r")")

def parseline(line):
sline = line.split()
Expand Down Expand Up @@ -98,69 +102,119 @@ def parseline(line):
'sortkey': sortkey,
}

def dedup(ips):
'''deduplicate by address,port'''
d = {}
for ip in ips:
d[ip['ip'],ip['port']] = ip
return list(d.values())

def filtermultiport(ips):
'''Filter out hosts with more nodes per IP'''
hist = collections.defaultdict(list)
for ip in ips:
hist[ip['sortkey']].append(ip)
return [value[0] for (key,value) in list(hist.items()) if len(value)==1]

def lookup_asn(net, ip):
'''
Look up the asn for an IP (4 or 6) address by querying cymru.com, or None
if it could not be found.
'''
try:
if net == 'ipv4':
ipaddr = ip
prefix = '.origin'
else: # http://www.team-cymru.com/IP-ASN-mapping.html
res = str() # 2001:4860:b002:23::68
for nb in ip.split(':')[:4]: # pick the first 4 nibbles
for c in nb.zfill(4): # right padded with '0'
res += c + '.' # 2001 4860 b002 0023
ipaddr = res.rstrip('.') # 2.0.0.1.4.8.6.0.b.0.0.2.0.0.2.3
prefix = '.origin6'

asn = int([x.to_text() for x in dns.resolver.query('.'.join(
reversed(ipaddr.split('.'))) + prefix + '.asn.cymru.com',
'TXT').response.answer][0].split('\"')[1].split(' ')[0])
return asn
except Exception:
sys.stderr.write('ERR: Could not resolve ASN for "' + ip + '"\n')
return None

# Based on Greg Maxwell's seed_filter.py
def filterbyasn(ips, max_per_asn, max_total):
def filterbyasn(ips, max_per_asn, max_per_net):
# Sift out ips by type
ips_ipv4 = [ip for ip in ips if ip['net'] == 'ipv4']
ips_ipv6 = [ip for ip in ips if ip['net'] == 'ipv6']
ips_ipv46 = [ip for ip in ips if ip['net'] in ['ipv4', 'ipv6']]
ips_onion = [ip for ip in ips if ip['net'] == 'onion']

# Filter IPv4 by ASN
# Filter IPv46 by ASN, and limit to max_per_net per network
result = []
asn_count = {}
for ip in ips_ipv4:
if len(result) == max_total:
break
try:
asn = int([x.to_text() for x in dns.resolver.query('.'.join(reversed(ip['ip'].split('.'))) + '.origin.asn.cymru.com', 'TXT').response.answer][0].split('\"')[1].split(' ')[0])
if asn not in asn_count:
asn_count[asn] = 0
if asn_count[asn] == max_per_asn:
continue
asn_count[asn] += 1
result.append(ip)
except:
sys.stderr.write('ERR: Could not resolve ASN for "' + ip['ip'] + '"\n')

# TODO: filter IPv6 by ASN

# Add back non-IPv4
result.extend(ips_ipv6)
result.extend(ips_onion)
net_count = collections.defaultdict(int)
asn_count = collections.defaultdict(int)
for ip in ips_ipv46:
if net_count[ip['net']] == max_per_net:
continue
asn = lookup_asn(ip['net'], ip['ip'])
if asn is None or asn_count[asn] == max_per_asn:
continue
asn_count[asn] += 1
net_count[ip['net']] += 1
result.append(ip)

# Add back Onions (up to max_per_net)
result.extend(ips_onion[0:max_per_net])
return result

def ip_stats(ips):
hist = collections.defaultdict(int)
for ip in ips:
if ip is not None:
hist[ip['net']] += 1

return '%6d %6d %6d' % (hist['ipv4'], hist['ipv6'], hist['onion'])

def main():
lines = sys.stdin.readlines()
ips = [parseline(line) for line in lines]

# Skip entries with valid address.
print('\x1b[7m IPv4 IPv6 Onion Pass \x1b[0m', file=sys.stderr)
print('%s Initial' % (ip_stats(ips)), file=sys.stderr)
# Skip entries with invalid address.
ips = [ip for ip in ips if ip is not None]
print('%s Skip entries with invalid address' % (ip_stats(ips)), file=sys.stderr)
# Skip duplicates (in case multiple seeds files were concatenated)
ips = dedup(ips)
print('%s After removing duplicates' % (ip_stats(ips)), file=sys.stderr)
# Skip entries from suspicious hosts.
ips = [ip for ip in ips if ip['ip'] not in SUSPICIOUS_HOSTS]
print('%s Skip entries from suspicious hosts' % (ip_stats(ips)), file=sys.stderr)
# Enforce minimal number of blocks.
ips = [ip for ip in ips if ip['blocks'] >= MIN_BLOCKS]
print('%s Enforce minimal number of blocks' % (ip_stats(ips)), file=sys.stderr)
# Require service bit 1.
ips = [ip for ip in ips if (ip['service'] & 1) == 1]
# Require at least 50% 30-day uptime.
ips = [ip for ip in ips if ip['uptime'] > 50]
print('%s Require service bit 1' % (ip_stats(ips)), file=sys.stderr)
# Require at least 50% 30-day uptime for clearnet, 10% for onion.
req_uptime = {
'ipv4': 50,
'ipv6': 50,
'onion': 10,
}
ips = [ip for ip in ips if ip['uptime'] > req_uptime[ip['net']]]
print('%s Require minimum uptime' % (ip_stats(ips)), file=sys.stderr)
# Require a known and recent user agent.
ips = [ip for ip in ips if PATTERN_AGENT.match(re.sub(' ', '-', ip['agent']))]
ips = [ip for ip in ips if PATTERN_AGENT.match(ip['agent'])]
print('%s Require a known and recent user agent' % (ip_stats(ips)), file=sys.stderr)
# Sort by availability (and use last success as tie breaker)
ips.sort(key=lambda x: (x['uptime'], x['lastsuccess'], x['ip']), reverse=True)
# Filter out hosts with multiple bitcoin ports, these are likely abusive
# Filter out hosts with multiple pivx ports, these are likely abusive
ips = filtermultiport(ips)
print('%s Filter out hosts with multiple pivx ports' % (ip_stats(ips)), file=sys.stderr)
# Look up ASNs and limit results, both per ASN and globally.
ips = filterbyasn(ips, MAX_SEEDS_PER_ASN, NSEEDS)
print('%s Look up ASNs and limit results per ASN and per net' % (ip_stats(ips)), file=sys.stderr)
# Sort the results by IP address (for deterministic output).
ips.sort(key=lambda x: (x['net'], x['sortkey']))

for ip in ips:
if ip['net'] == 'ipv6':
print('[%s]:%i' % (ip['ip'], ip['port']))
Expand Down
Empty file.
4 changes: 3 additions & 1 deletion doc/tor.md
Expand Up @@ -46,14 +46,16 @@ config file): *Needed for Tor version 0.2.7.0 and older versions of Tor only. Fo
versions of Tor see [Section 3](#3-automatically-listen-on-tor).*

HiddenServiceDir /var/lib/tor/pivx-service/
HiddenServiceVersion 2
HiddenServicePort 51472 127.0.0.1:51472
HiddenServicePort 61472 127.0.0.1:61472

The directory can be different of course, but (both) port numbers should be equal to
your pivxd's P2P listen port (51472 by default).

-externalip=X You can tell pivx about its publicly reachable address using
this option, and this can be a .onion address. Given the above
this option, and this can be a v2 .onion address (v3 .onion
addresses are not supported by the PIVX network). Given the above
configuration, you can find your .onion address in
/var/lib/tor/pivx-service/hostname. For connections
coming from unroutable addresses (such as 127.0.0.1, where the
Expand Down
22 changes: 1 addition & 21 deletions src/Makefile.qt_locale.include
@@ -1,34 +1,14 @@
QT_TS = \
qt/locale/pivx_bg.ts \
qt/locale/pivx_ca.ts \
qt/locale/pivx_cs.ts \
qt/locale/pivx_da.ts \
qt/locale/pivx_de.ts \
qt/locale/pivx_en.ts \
qt/locale/pivx_en_GB.ts \
qt/locale/pivx_en_US.ts \
qt/locale/pivx_eo.ts \
qt/locale/pivx_es.ts \
qt/locale/pivx_es_ES.ts \
qt/locale/pivx_fi.ts \
qt/locale/pivx_fr_FR.ts \
qt/locale/pivx_hi_IN.ts \
qt/locale/pivx_hr.ts \
qt/locale/pivx_hr_HR.ts \
qt/locale/pivx_it.ts \
qt/locale/pivx_ja.ts \
qt/locale/pivx_ko_KR.ts \
qt/locale/pivx_lt_LT.ts \
qt/locale/pivx_nl.ts \
qt/locale/pivx_pl.ts \
qt/locale/pivx_pt.ts \
qt/locale/pivx_pt_BR.ts \
qt/locale/pivx_ro_RO.ts \
qt/locale/pivx_ru.ts \
qt/locale/pivx_sk.ts \
qt/locale/pivx_sv.ts \
qt/locale/pivx_tr.ts \
qt/locale/pivx_uk.ts \
qt/locale/pivx_vi.ts \
qt/locale/pivx_zh_CN.ts \
qt/locale/pivx_zh_TW.ts
qt/locale/pivx_zh_CN.ts
2 changes: 1 addition & 1 deletion src/activemasternode.cpp
@@ -1,5 +1,5 @@
// Copyright (c) 2014-2016 The Dash developers
// Copyright (c) 2015-2019 The PIVX developers
// Copyright (c) 2015-2020 The PIVX developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down
2 changes: 1 addition & 1 deletion src/activemasternode.h
@@ -1,5 +1,5 @@
// Copyright (c) 2014-2016 The Dash developers
// Copyright (c) 2015-2019 The PIVX developers
// Copyright (c) 2015-2020 The PIVX developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down
2 changes: 1 addition & 1 deletion src/addrman.cpp
@@ -1,6 +1,6 @@
// Copyright (c) 2012 Pieter Wuille
// Copyright (c) 2012-2014 The Bitcoin developers
// Copyright (c) 2017-2019 The PIVX developers
// Copyright (c) 2017-2020 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down
2 changes: 1 addition & 1 deletion src/addrman.h
@@ -1,6 +1,6 @@
// Copyright (c) 2012 Pieter Wuille
// Copyright (c) 2012-2014 The Bitcoin developers
// Copyright (c) 2017-2019 The PIVX developers
// Copyright (c) 2017-2020 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down
2 changes: 1 addition & 1 deletion src/amount.h
@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2017-2019 The PIVX developers
// Copyright (c) 2017-2020 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down
2 changes: 1 addition & 1 deletion src/base58.h
@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2017-2019 The PIVX developers
// Copyright (c) 2017-2020 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down
2 changes: 1 addition & 1 deletion src/bip38.cpp
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2019 The PIVX developers
// Copyright (c) 2017-2020 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down