Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
luyu-chain33-plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
luyu-chain33-plugin
Commits
5e2f36e6
Commit
5e2f36e6
authored
Feb 18, 2022
by
suyanlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused code
parent
1abf690d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
59 deletions
+5
-59
Chain33.scala
src/main/scala/com/chain33/util/Chain33.scala
+0
-5
ChainUtils.scala
src/main/scala/com/chain33/util/ChainUtils.scala
+5
-54
No files found.
src/main/scala/com/chain33/util/Chain33.scala
deleted
100644 → 0
View file @
1abf690d
package
com.chain33.util
trait
Chain33
{
def
Build
()
:
Unit
}
src/main/scala/com/chain33/util/ChainUtils.scala
View file @
5e2f36e6
...
@@ -4,59 +4,10 @@ import java.math.BigInteger
...
@@ -4,59 +4,10 @@ import java.math.BigInteger
import
java.util.Random
import
java.util.Random
object
ChainUtils
{
object
ChainUtils
{
private
var
version
=
2
private
val
version
=
2
private
var
chainId
=
BigInteger
.
valueOf
(
1L
)
private
val
chainId
=
BigInteger
.
valueOf
(
1L
)
private
var
currentHeight
=
new
BigInteger
(
"0"
)
private
val
RANDOM
=
new
Random
val
ABI_ADDRESS
=
"ffffffffffffffffffffffffffffffffff010001"
def
getVersion
:
Int
=
version
private
val
RANDOM
=
new
Random
def
initChainDatas
(
chain_version
:
Int
,
chain_id
:
BigInteger
)
:
Unit
=
{
version
=
chain_version
chainId
=
chain_id
}
def
getVersion
:
Int
=
version
def
getChainId
:
BigInteger
=
chainId
def
getChainId
:
BigInteger
=
chainId
def
getNonce
:
String
=
System
.
nanoTime
+
String
.
valueOf
(
RANDOM
.
nextInt
(
100000
)
+
900000
)
def
getNonce
:
String
=
System
.
nanoTime
+
String
.
valueOf
(
RANDOM
.
nextInt
(
100000
)
+
900000
)
def
getCurrentHeight
(
service
:
Chain33
)
:
BigInteger
=
getCurrentHeight
(
service
,
3
)
def
setCurrentHeight
(
height
:
BigInteger
)
:
Unit
=
{
currentHeight
=
height
}
def
getCurrentHeight
:
BigInteger
=
currentHeight
private
def
getCurrentHeight
(
service
:
Chain33
,
retry
:
Int
)
=
{
var
count
=
0
var
height
=
0L
height
=
-
1L
while
(
count
<
retry
)
{
// try height = service.appBlockNumber.send.getBlockNumber.longValue//TODO
try
height
=
0
// TODO
catch
{
case
var8
:
Exception
=>
height
=
-
1L
println
(
"getBlockNumber failed retry .."
)
try
Thread
.
sleep
(
2000L
)
catch
{
case
var7
:
Exception
=>
println
(
"failed to get block number, Exception: $var7"
)
}
}
count
+=
1
}
if
(
height
==
-
1L
)
{
println
(
s
"Failed to get block number after $count times"
)
}
BigInteger
.
valueOf
(
height
)
}
def
getValidUtilBlock
(
validUntilBlock
:
Int
)
:
BigInteger
=
getCurrentHeight
.
add
(
BigInteger
.
valueOf
(
validUntilBlock
))
def
getValidUtilBlock
(
service
:
Chain33
,
validUntilBlock
:
Int
)
:
BigInteger
=
getCurrentHeight
(
service
).
add
(
BigInteger
.
valueOf
(
validUntilBlock
))
}
}
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