Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
7b2e6752
Commit
7b2e6752
authored
Feb 27, 2018
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
master: fix/simplify generation of TID
The 'min_tid < new_tid' assertion failed when jumping to the past.
parent
ca2f7061
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
22 deletions
+9
-22
neo/master/transactions.py
neo/master/transactions.py
+9
-22
No files found.
neo/master/transactions.py
View file @
7b2e6752
...
...
@@ -234,29 +234,16 @@ class TransactionManager(EventQueue):
tid
=
tidFromTime
(
time
())
min_tid
=
self
.
_last_tid
if
tid
<=
min_tid
:
tid
=
addTID
(
min_tid
,
1
)
# We know we won't have room to adjust by decreasing.
try_decrease
=
False
else
:
try_decrease
=
True
tid
=
addTID
(
min_tid
,
1
)
if
ttid
is
not
None
:
assert
isinstance
(
ttid
,
basestring
),
repr
(
ttid
)
assert
isinstance
(
divisor
,
(
int
,
long
)),
repr
(
divisor
)
ref_remainder
=
u64
(
ttid
)
%
divisor
remainder
=
u64
(
tid
)
%
divisor
if
ref_remainder
!=
remainder
:
if
try_decrease
:
new_tid
=
addTID
(
tid
,
ref_remainder
-
divisor
-
remainder
)
assert
u64
(
new_tid
)
%
divisor
==
ref_remainder
,
(
dump
(
new_tid
),
ref_remainder
)
if
new_tid
<=
min_tid
:
new_tid
=
addTID
(
new_tid
,
divisor
)
else
:
if
ref_remainder
>
remainder
:
ref_remainder
+=
divisor
new_tid
=
addTID
(
tid
,
ref_remainder
-
remainder
)
assert
min_tid
<
new_tid
,
(
dump
(
min_tid
),
dump
(
tid
),
dump
(
new_tid
))
tid
=
new_tid
remainder
=
u64
(
ttid
)
%
divisor
delta_remainder
=
remainder
-
u64
(
tid
)
%
divisor
if
delta_remainder
:
tid
=
addTID
(
tid
,
delta_remainder
)
if
tid
<=
min_tid
:
tid
=
addTID
(
tid
,
divisor
)
assert
u64
(
tid
)
%
divisor
==
remainder
,
(
dump
(
tid
),
remainder
)
assert
min_tid
<
tid
,
(
dump
(
min_tid
),
dump
(
tid
))
self
.
_last_tid
=
tid
return
self
.
_last_tid
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment