Skip to content

Commit

Permalink
Merge branch 'master' into bitcoinsync31July2023
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-emma authored Mar 25, 2024
2 parents e36f52f + 217e921 commit d875c76
Show file tree
Hide file tree
Showing 145 changed files with 1,346 additions and 1,408 deletions.
5 changes: 0 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ what is the goal of the pull request
Pull requests without a rationale and clear improvement may be closed
immediately.

GUI-related pull requests should be opened against
https://github.com/BGL-core/gui
first. See CONTRIBUTING.md
-->

### Notes
implementation details, hints for reviewers

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ Rebased-From: <commit hash of the original commit>
```

Have a look at [an example backport PR](
https://github.com/BGL/BGL/pull/16189).
https://github.com/bitcoin/bitcoin/pull/16189).

Also see the [backport.py script](
https://github.com/BGL-core/BGL-maintainer-tools#backport).
Expand Down
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,31 @@ Features:
* Optional module for ECDH key exchange.
* Optional module for Schnorr signatures according to [BIP-340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki).

Implementation details
----------------------
<b>Bitgesell is a fork of Bitcoin with the following changes:</b> <br>
* Block Reward [Burn rate is 90% of tx fees]
```sh
nFees*0.1 + GetBlockSubsidy()
```
* Block Weight [10 times smaller than Bitcoin]
```sh
<= 400,000
```
* 100% Segwit
```sh
Eliminates problems with legacy type of transactions
```
* Halving Interval [Halving cycle of bitgetsell is 1yr while that of BGL is 4yr]
```sh
210000 blocks/4
```
* Block Subsidy [Max coins = 21,000,000] <br>
`210000 blocks/4` <br> <hr>
`Hashing algorithm for blocks is Keccak (sha-3).` <br> <hr>
`The master branch is regularly built (see` [doc/build-*.md](https://github.com/BitgesellOfficial/bitgesell/tree/master/doc) `for instructions) and tested, but is not guaranteed to be completely stable.` <br> <hr>
[tags](https://github.com/BitgesellOfficial/bitgesell/tags) `are created regularly to indicate new official, stable release versions of BGL Core.` <br>


### Built With

* General
* No runtime heap allocation.
Expand Down
12 changes: 6 additions & 6 deletions build_msvc/BGL_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
#define BGL_BGL_CONFIG_H

/* Version Build */
#define CLIENT_VERSION_BUILD 6
#define CLIENT_VERSION_BUILD 0

/* Version is release */
#define CLIENT_VERSION_IS_RELEASE true

/* Major version */
#define CLIENT_VERSION_MAJOR 22
#define CLIENT_VERSION_MAJOR 1

/* Minor version */
#define CLIENT_VERSION_MINOR 1
#define CLIENT_VERSION_MINOR 8

/* Copyright holder(s) before %s replacement */
#define COPYRIGHT_HOLDERS "The %s developers"
Expand All @@ -27,7 +27,7 @@
#define COPYRIGHT_HOLDERS_SUBSTITUTION "Bitcoin Core"

/* Copyright year */
#define COPYRIGHT_YEAR 2021
#define COPYRIGHT_YEAR 2022

/* Define to 1 to enable wallet functions */
#define ENABLE_WALLET 1
Expand Down Expand Up @@ -183,10 +183,10 @@
#define PACKAGE_STRING "Bitgesell Core 22.99.0"

/* Define to the home page for this package. */
#define PACKAGE_URL "https://github.com/BitgesellOfficial/bitgesell/releases/"
#define PACKAGE_URL "https://bitgesell.ca/"

/* Define to the version of this package. */
#define PACKAGE_VERSION "22.99.0"
#define PACKAGE_VERSION "0.1.8"

/* Define this symbol if the minimal qt platform exists */
#define QT_QPA_PLATFORM_MINIMAL 1
Expand Down
2 changes: 1 addition & 1 deletion build_msvc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Introduction
---------------------
Visual Studio 2022 is minimum required to build BGL Core.

Solution and project files to build with `msbuild` or Visual Studio can be found in the `build_msvc` directory.
Building with Visual Studio is an alternative to the Linux based [cross-compiler build](https://github.com/BitgesellOfficial/bitgesell/blob/master/doc/build-windows.md).

To build BGL Core from the command-line, it is sufficient to only install the [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/) component.

Expand Down
2 changes: 2 additions & 0 deletions build_msvc/libBGL_qt/libBGL_qt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<ClCompile Include="..\..\src\qt\overviewpage.cpp" />
<ClCompile Include="..\..\src\qt\paymentserver.cpp" />
<ClCompile Include="..\..\src\qt\peertablemodel.cpp" />
<ClCompile Include="..\..\src\qt\peertablesortproxy.cpp" />
<ClCompile Include="..\..\src\qt\platformstyle.cpp" />
<ClCompile Include="..\..\src\qt\psbtoperationsdialog.cpp" />
<ClCompile Include="..\..\src\qt\qrimagewidget.cpp" />
Expand Down Expand Up @@ -90,6 +91,7 @@
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_overviewpage.cpp" />
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_paymentserver.cpp" />
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_peertablemodel.cpp" />
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_peertablesortproxy.cpp" />
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_platformstyle.cpp" />
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_psbtoperationsdialog.cpp" />
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_qrimagewidget.cpp" />
Expand Down
17 changes: 6 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,7 @@ AC_ARG_ENABLE([werror],
AC_ARG_ENABLE([external-signer],
[AS_HELP_STRING([--enable-external-signer],[compile external signer support (default is auto, requires Boost::Process)])],
[use_external_signer=$enableval],
[use_external_signer=auto])

AC_ARG_ENABLE([lto],
[AS_HELP_STRING([--enable-lto],[build using LTO (default is no)])],
[enable_lto=$enableval],
[enable_lto=no])
[use_external_signer=yes])

AC_LANG_PUSH([C++])

Expand Down Expand Up @@ -461,11 +456,11 @@ if test "$CXXFLAGS_overridden" = "no"; then
dnl Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
dnl unknown options if any other warning is produced. Test the -Wfoo case, and
dnl set the -Wno-foo case if it works.
AX_CHECK_COMPILE_FLAG([-Wunused-parameter], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-parameter"], [], [$CXXFLAG_WERROR])
AX_CHECK_COMPILE_FLAG([-Wself-assign], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-self-assign"], [], [$CXXFLAG_WERROR])
if test "$suppress_external_warnings" != "yes" ; then
AX_CHECK_COMPILE_FLAG([-Wdeprecated-copy], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-deprecated-copy"], [], [$CXXFLAG_WERROR])
fi
AX_CHECK_COMPILE_FLAG([-Wunused-parameter],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-parameter"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wself-assign],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-self-assign"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wunused-local-typedef],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-local-typedef"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-implicit-fallthrough"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wdeprecated-copy],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-deprecated-copy"],,[[$CXXFLAG_WERROR]])
fi

dnl Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review.
Expand Down
31 changes: 30 additions & 1 deletion contrib/linearize/linearize-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
import hashlib
import datetime
import time
import glob
from collections import namedtuple



settings = {}

def calc_hash_str(blk_hdr):
Expand Down Expand Up @@ -53,6 +56,30 @@ def mkblockmap(blkindex):
blkmap[hash] = height
return blkmap

# This gets the first block file ID that exists from the input block
# file directory.
def getFirstBlockFileId(block_dir_path):
# First, this sets up a pattern to search for block files, for
# example 'blkNNNNN.dat'.
blkFilePattern = os.path.join(block_dir_path, "blk[0-9][0-9][0-9][0-9][0-9].dat")

# This search is done with glob
blkFnList = glob.glob(blkFilePattern)

if len(blkFnList) == 0:
print("blocks not pruned - starting at 0")
return 0
# We then get the lexicographic minimum, which should be the first
# block file name.
firstBlkFilePath = min(blkFnList)
firstBlkFn = os.path.basename(firstBlkFilePath)

# now, the string should be ['b','l','k','N','N','N','N','N','.','d','a','t']
# So get the ID by choosing: 3 4 5 6 7
# The ID is not necessarily 0 if this is a pruned node.
blkId = int(firstBlkFn[3:8])
return blkId

# Block header and extent on disk
BlockExtent = namedtuple('BlockExtent', ['fn', 'offset', 'inhdr', 'blkhdr', 'size'])

Expand All @@ -62,7 +89,9 @@ def __init__(self, settings, blkindex, blkmap):
self.blkindex = blkindex
self.blkmap = blkmap

self.inFn = 0
# Get first occurring block file id - for pruned nodes this
# will not necessarily be 0
self.inFn = getFirstBlockFileId(self.settings['input'])
self.inF = None
self.outFn = 0
self.outsz = 0
Expand Down
8 changes: 0 additions & 8 deletions contrib/seeds/asmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
def net_to_prefix(net: Union[ipaddress.IPv4Network,ipaddress.IPv6Network]) -> List[bool]:
"""
Convert an IPv4 or IPv6 network to a prefix represented as a list of bits.
IPv4 ranges are remapped to their IPv4-mapped IPv6 range (::ffff:0:0/96).
"""
num_bits = net.prefixlen
Expand Down Expand Up @@ -57,14 +56,12 @@ class _VarLenCoder:
A class representing a custom variable-length binary encoder/decoder for
integers. Each object represents a different coder, with different parameters
minval and clsbits.
The encoding is easiest to describe using an example. Let's say minval=100 and
clsbits=[4,2,2,3]. In that case:
- x in [100..115]: encoded as [0] + [4-bit BE encoding of (x-100)].
- x in [116..119]: encoded as [1,0] + [2-bit BE encoding of (x-116)].
- x in [120..123]: encoded as [1,1,0] + [2-bit BE encoding of (x-120)].
- x in [124..131]: encoded as [1,1,1] + [3-bit BE encoding of (x-124)].
In general, every number is encoded as:
- First, k "1"-bits, where k is the class the number falls in (there is one class
per element of clsbits).
Expand Down Expand Up @@ -269,10 +266,8 @@ def make_default(val: int, sub: "_BinNode") -> "_BinNode":
class ASMap:
"""
A class whose objects represent a mapping from subnets to ASNs.
Internally the mapping is stored as a binary trie, but can be converted
from/to a list of ASNEntry objects, and from/to the binary asmap file format.
In the trie representation, nodes are represented as bare lists for efficiency
and ease of manipulation:
- [0] means an unassigned subnet (no ASN mapping for it is present)
Expand Down Expand Up @@ -420,7 +415,6 @@ def __str__(self) -> str:
def to_entries(self, overlapping: bool = True, fill: bool = False) -> List[ASNEntry]:
"""
Convert the mappings in this ASMap object to a list of ASNEntry objects.
Arguments:
overlapping: Permit the subnets in the resulting ASNEntry to overlap.
Setting this can result in a shorter list.
Expand All @@ -440,7 +434,6 @@ def from_random(num_leaves: int = 10, max_asn: int = 6,
- Number of leaves in its trie (at least 1)
- Maximum ASN value (at least 1)
- Probability for leaf nodes to be unassigned
The number of leaves in the resulting object may be less than what is
requested. This method is mostly intended for testing.
"""
Expand Down Expand Up @@ -534,7 +527,6 @@ def recurse(node: _BinNode, default: int) -> List:
def to_binary(self, fill: bool = False) -> bytes:
"""
Convert this ASMap object to binary.
Argument:
fill: permit the resulting binary encoder to contain mappers for
unassigned subnets in this ASMap object. Doing so may
Expand Down
17 changes: 5 additions & 12 deletions contrib/seeds/generate-seeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,20 @@
This script expects two text files in the directory that is passed as an
argument:
nodes_main.txt
nodes_test.txt
These files must consist of lines in the format
These files must consist of lines in the format
<ip>:<port>
[<ipv6>]:<port>
<onion>.onion:<port>
<i2p>.b32.i2p:<port>
The output will be two data structures with the peers in binary format:
static const uint8_t chainparams_seed_{main,test}[]={
...
}
These should be pasted into `src/chainparamsseeds.h`.
'''
from __future__ import print_function, division

from base64 import b32decode
from enum import Enum
import struct
Expand Down Expand Up @@ -58,7 +52,7 @@ def name_to_bip155(addr):
if len(vchAddr) == 32:
return (BIP155Network.I2P, vchAddr)
else:
raise ValueError(f'Invalid I2P {vchAddr}')
raise ValueError(f"Invalid I2P {vchAddr}")
elif '.' in addr: # IPv4
return (BIP155Network.IPV4, bytes((int(x) for x in addr.split('.'))))
elif ':' in addr: # IPv6 or CJDNS
Expand Down Expand Up @@ -156,13 +150,13 @@ def process_nodes(g, f, structname):
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 BGL_CHAINPARAMSSEEDS_H\n')
g.write('#define BGL_CHAINPARAMSSEEDS_H\n')
g.write('/**\n')
g.write(' * List of fixed seed nodes for the falco network\n')
g.write(' * List of fixed seed nodes for the bitgesell network\n')
g.write(' * AUTOGENERATED by contrib/seeds/generate-seeds.py\n')
g.write(' *\n')
g.write(' * Each line contains a BIP155 serialized (networkID, addr, port) tuple.\n')
Expand All @@ -176,4 +170,3 @@ def main():

if __name__ == '__main__':
main()

9 changes: 4 additions & 5 deletions contrib/seeds/makeseeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,10 @@ def filterbyasn(asmap: ASMap, ips: List[Dict], max_per_asn: Dict, max_per_net: i
(b) trimming ips to have at most `max_per_asn` ips from each asn in each 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 = []
net_count: Dict[str, int] = collections.defaultdict(int)
asn_count: Dict[int, int] = collections.defaultdict(int)
Expand Down Expand Up @@ -185,6 +184,7 @@ def main():
asmap = ASMap.from_binary(f.read())
print('Done.', file=sys.stderr)

print('Loading and parsing DNS seeds…', end='', file=sys.stderr, flush=True)
lines = sys.stdin.readlines()
ips = [parseline(line) for line in lines]
print('Done.', file=sys.stderr)
Expand Down Expand Up @@ -216,15 +216,14 @@ def main():
print(f'{ip_stats(ips):s} Require a known and recent user agent', 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 ports, these are likely abusive
# Filter out hosts with multiple bitcoin ports, these are likely abusive
ips = filtermultiport(ips)
print(f'{ip_stats(ips):s} Filter out hosts with multiple BGL ports', file=sys.stderr)
# Look up ASNs and limit results, both per ASN and globally.
ips = filterbyasn(asmap, ips, MAX_SEEDS_PER_ASN, NSEEDS)
print(f'{ip_stats(ips):s} Look up ASNs and limit results per ASN and per net', 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(f"[{ip['ip']}]:{ip['port']}", end="")
Expand Down
Empty file added contrib/testgen/base58.py
Empty file.
6 changes: 3 additions & 3 deletions debian.minimal/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -1721,8 +1721,8 @@ Files: doc/man/BGL-cli.1
Copyright: 2009-2019 The Bitcoin Core developers
License: __UNKNOWN__
Please contribute if you find BGL Core useful. Visit
<https://BGLcore.org> for further information about the software.
The source code is available from <https://github.com/BGL/BGL>.
<https://bitgesell.ca> for further information about the software.
The source code is available from <https://github.com/BitgesellOfficial/bitgesell>.
.
This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
Expand Down Expand Up @@ -2630,7 +2630,7 @@ Files: contrib/verifybinaries/verify.sh
Copyright: 2016 The Bitcoin Core developers Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
License: __UNKNOWN__
This script attempts to download the signature file SHA256SUMS.asc from
BGLcore.org and BGL.org and compares them.
bitgesell.ca and BGL.org and compares them.
It first checks if the signature passes, and then downloads the files specified in
the file, and checks if the hashes of these files match those that are specified
in the signature file.
Expand Down
7 changes: 1 addition & 6 deletions depends/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@ NO_UPNP ?=
NO_USDT ?=
NO_NATPMP ?=
MULTIPROCESS ?=
LTO ?=
NO_HARDEN ?=
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources

C_STANDARD ?= c11
CXX_STANDARD ?= c++17
FALLBACK_DOWNLOAD_PATH ?= https://bitgesell.ca/depends-sources

BUILD = $(shell ./config.guess)
HOST ?= $(BUILD)
Expand Down
Loading

0 comments on commit d875c76

Please sign in to comment.