Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mining in Logarithmic Space
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOISON Benjamin
Mining in Logarithmic Space
Commits
39d05af4
Unverified
Commit
39d05af4
authored
1 year ago
by
Benjamin Loison
Browse files
Options
Downloads
Patches
Plain Diff
Simplify `U` by removing `{lower,upper}Bound` parameters
parent
1acf798e
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
block.py
+1
-2
1 addition, 2 deletions
block.py
mining_in_logarithmic_space.py
+3
-3
3 additions, 3 deletions
mining_in_logarithmic_space.py
mining_in_logarithmic_space_constant_difficulty.py
+1
-1
1 addition, 1 deletion
mining_in_logarithmic_space_constant_difficulty.py
with
5 additions
and
6 deletions
block.py
+
1
−
2
View file @
39d05af4
...
...
@@ -3,8 +3,7 @@ import math
# bits_to_target(int(headers[0]['bits'], 16))
genesisTarget
=
26959535291011309493156476344723991336010898738574164086137773096960
IS_EPSILON_TARGET_DEFINITION
=
True
# Could be determined thanks to `sys.argv[0]` but I'm unsure what is our statement concerning running in an IDE such as Pyzo or if it would work fine on Windows (notably due to the possible `./` prefix).
MINING_IN_LOGARITHMIC_SPACE_CONSTANT_DIFFICULTY_LEVEL
=
True
MINING_IN_LOGARITHMIC_SPACE_CONSTANT_DIFFICULTY_LEVEL
=
False
class
Block
:
# `target` and `_hash` are `int`s.
...
...
This diff is collapsed.
Click to expand it.
mining_in_logarithmic_space.py
+
3
−
3
View file @
39d05af4
...
...
@@ -44,7 +44,7 @@ def Dissolve(m, k, C, previous_score, previous_ℓ):
def
Compress
(
m
,
k
,
C
,
previous_score
,
previous_ℓ
):
(
D
,
ℓ
,
χ
,
new_score
)
=
Dissolve
(
m
,
k
,
C
,
previous_score
,
previous_ℓ
)
π
=
U
(
0
,
ℓ
,
D
)
π
=
U
(
D
)
return
π
+
χ
,
new_score
,
ℓ
def
uparrow
(
C
,
μ
):
...
...
@@ -93,9 +93,9 @@ def llbracket(C, μ, CIndex, actually = False):
def
score
(
C
,
ℓ
):
return
sum
([(
min
(
block
.
level
,
ℓ
)
+
1
-
block
.
level_min
)
*
block
.
score
for
block
in
C
])
def
U
(
lowerBound
,
upperBound
,
chains
):
def
U
(
chains
):
chains
=
[
chains
[
μ
]
for
μ
in
chains
]
flattened_chain
=
[
block
for
chain
in
chains
[
lowerBound
:
upperBound
+
1
]
for
block
in
chain
]
flattened_chain
=
[
block
for
chain
in
chains
for
block
in
chain
]
unique_blocks
=
{}
for
block
in
flattened_chain
:
if
not
block
.
height
in
unique_blocks
or
block
.
level_min
<
unique_blocks
[
block
.
height
].
level_min
:
...
...
This diff is collapsed.
Click to expand it.
mining_in_logarithmic_space_constant_difficulty.py
+
1
−
1
View file @
39d05af4
...
...
@@ -21,7 +21,7 @@ def Dissolve(m, k, C, previous_score, previous_ℓ):
CStarμ
=
uparrow
(
CStar
,
μ
)
CStarμSinceb
=
[
block
for
block
in
CStarμ
if
block
.
height
>=
b
.
height
]
chains
=
{
chainsIndex
:
chain
for
chainsIndex
,
chain
in
enumerate
([
CStarμ
[
-
2
*
m
:],
CStarμSinceb
])}
D
[
μ
]
=
U
(
0
,
1
,
chains
)
D
[
μ
]
=
U
(
chains
)
previousCStarμ
=
CStarμ
else
:
ℓ
=
0
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment