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
9863e814
Commit
9863e814
authored
6 years ago
by
Miguel Montes
Browse files
Options
Downloads
Patches
Plain Diff
Corrección de bug en la obtención de coinbase en nodos sin cuentas.
parent
fa1aafc4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bfa_client/src/bfa/node.go
+12
-19
12 additions, 19 deletions
bfa_client/src/bfa/node.go
with
12 additions
and
19 deletions
bfa_client/src/bfa/node.go
+
12
−
19
View file @
9863e814
...
...
@@ -2,7 +2,6 @@ package bfa
import
(
.
"../util"
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus/clique"
"github.com/ethereum/go-ethereum/p2p"
...
...
@@ -55,6 +54,10 @@ func (node *Node) Call(result interface{}, method string, args ...interface{}) {
Check
((
*
rpc
.
Client
)(
node
)
.
Call
(
result
,
method
,
args
...
))
}
func
(
node
*
Node
)
CallWithError
(
result
interface
{},
method
string
,
args
...
interface
{})
error
{
return
(
*
rpc
.
Client
)(
node
)
.
Call
(
result
,
method
,
args
...
)
}
func
(
node
*
Node
)
BlockNumber
()
int64
{
var
bn
rpc
.
BlockNumber
node
.
Call
(
&
bn
,
"eth_blockNumber"
)
...
...
@@ -87,22 +90,8 @@ func (node *Node) Balance(account common.Address) *big.Int {
return
node
.
BalanceAtBlock
(
account
,
-
1
)
}
func
(
node
*
Node
)
Coinbase
()
(
coinbase
string
,
err
error
)
{
defer
func
()
{
if
e
:=
recover
();
e
!=
nil
{
switch
s
:=
e
.
(
type
)
{
case
string
:
err
=
fmt
.
Errorf
(
s
)
case
error
:
err
=
s
default
:
err
=
fmt
.
Errorf
(
"unknown error while getting coinbase: %v"
,
e
)
}
}
}()
var
address
common
.
Address
node
.
Call
(
&
address
,
"eth_coinbase"
)
coinbase
=
BytesToHex
(
address
[
:
])
func
(
node
*
Node
)
Coinbase
()
(
address
string
,
err
error
)
{
err
=
node
.
CallWithError
(
&
address
,
"eth_coinbase"
)
return
}
...
...
@@ -190,7 +179,9 @@ func (node *Node) SealersAtBlock(blockNumber int64) (signers []string) {
func
(
node
*
Node
)
IsSealer
(
address
string
)
bool
{
if
address
==
Self
{
var
err
error
var
(
err
error
)
if
address
,
err
=
node
.
Coinbase
();
err
!=
nil
{
return
false
}
...
...
@@ -200,7 +191,9 @@ func (node *Node) IsSealer(address string) bool {
func
(
node
*
Node
)
IsSealerAtBlock
(
address
string
,
blockNumber
int64
)
bool
{
if
address
==
Self
{
var
err
error
var
(
err
error
)
if
address
,
err
=
node
.
Coinbase
();
err
!=
nil
{
return
false
}
...
...
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