Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
contrib
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blockchain
contrib
Commits
f17085d1
Commit
f17085d1
authored
6 years ago
by
Miguel Montes
Browse files
Options
Downloads
Patches
Plain Diff
Declarado tipo bfa.Address
parent
35327557
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bfa_client/src/bfa/node.go
+6
-0
6 additions, 0 deletions
bfa_client/src/bfa/node.go
bfa_client/src/client/bfa_client.go
+5
-5
5 additions, 5 deletions
bfa_client/src/client/bfa_client.go
bfa_client/src/util/util.go
+18
-0
18 additions, 0 deletions
bfa_client/src/util/util.go
with
29 additions
and
5 deletions
bfa_client/src/bfa/node.go
+
6
−
0
View file @
f17085d1
...
...
@@ -14,6 +14,8 @@ import (
type
Node
rpc
.
Client
type
Address
struct
{
common
.
Address
}
type
Snapshot
struct
{
Number
uint64
`json:"number"`
// Block number where the snapshot was created
Hash
common
.
Hash
`json:"hash"`
// Block hash where the snapshot was created
...
...
@@ -52,6 +54,10 @@ const (
SealerRounds
=
2
)
func
(
address
Address
)
MarshalText
()
([]
byte
,
error
)
{
return
[]
byte
(
address
.
Hex
()),
nil
}
func
(
node
*
Node
)
Call
(
result
interface
{},
method
string
,
args
...
interface
{})
{
Check
((
*
rpc
.
Client
)(
node
)
.
Call
(
result
,
method
,
args
...
))
}
...
...
This diff is collapsed.
Click to expand it.
bfa_client/src/client/bfa_client.go
+
5
−
5
View file @
f17085d1
...
...
@@ -504,10 +504,10 @@ func snapshot() {
func
transfers
()
{
type
Transfer
struct
{
From
string
`json:"from"`
To
string
`json:"to"`
Amount
*
big
.
Int
`json:"amount"`
BlockNumber
int64
`json:"blockNumber"`
From
bfa
.
Address
`json:"from"`
To
bfa
.
Address
`json:"to"`
Amount
*
big
.
Int
`json:"amount"`
BlockNumber
int64
`json:"blockNumber"`
}
var
(
first
,
last
,
end
int64
...
...
@@ -548,7 +548,7 @@ func transfers() {
dst
:=
transaction
.
To
if
len
(
set
)
==
0
||
set
[
src
]
||
set
[
dst
]
{
if
json
{
txs
=
append
(
txs
,
Transfer
{
src
.
Hex
(),
dst
.
Hex
()
,
(
*
big
.
Int
)(
transaction
.
Value
),
i
})
txs
=
append
(
txs
,
Transfer
{
bfa
.
Address
{
src
},
bfa
.
Address
{
dst
}
,
(
*
big
.
Int
)(
transaction
.
Value
),
i
})
}
else
{
fmt
.
Printf
(
"%v -> %v: %v (%v)
\n
"
,
src
.
Hex
(),
dst
.
Hex
(),
transaction
.
Value
,
transaction
.
BlockNumber
)
}
...
...
This diff is collapsed.
Click to expand it.
bfa_client/src/util/util.go
+
18
−
0
View file @
f17085d1
...
...
@@ -20,6 +20,24 @@ func Contains(slice []string, s string) bool {
return
false
}
func
ContainsAddress
(
slice
[]
common
.
Address
,
address
common
.
Address
)
bool
{
for
_
,
x
:=
range
slice
{
if
x
==
address
{
return
true
}
}
return
false
}
func
LessThanAddress
(
a
common
.
Address
,
b
common
.
Address
)
bool
{
for
i
,
x
:=
range
a
{
if
x
<
b
[
i
]
{
return
true
}
}
return
false
}
func
Error
(
format
string
,
args
...
interface
{})
{
_
,
_
=
fmt
.
Fprintf
(
os
.
Stderr
,
format
,
args
...
)
os
.
Exit
(
1
)
...
...
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