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
13aeb83f
Commit
13aeb83f
authored
6 years ago
by
Miguel Montes
Browse files
Options
Downloads
Patches
Plain Diff
Reorganización del código de bfa_client
parent
fd6f11a0
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/clique/clique.go
+44
-0
44 additions, 0 deletions
bfa_client/src/clique/clique.go
with
44 additions
and
0 deletions
bfa_client/src/clique/clique.go
0 → 100644
+
44
−
0
View file @
13aeb83f
package
clique
import
(
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/sha3"
"github.com/ethereum/go-ethereum/rlp"
"../util"
)
func
sigHash
(
header
*
types
.
Header
)
(
hash
common
.
Hash
)
{
hasher
:=
sha3
.
NewKeccak256
()
rlp
.
Encode
(
hasher
,
[]
interface
{}{
header
.
ParentHash
,
header
.
UncleHash
,
header
.
Coinbase
,
header
.
Root
,
header
.
TxHash
,
header
.
ReceiptHash
,
header
.
Bloom
,
header
.
Difficulty
,
header
.
Number
,
header
.
GasLimit
,
header
.
GasUsed
,
header
.
Time
,
header
.
Extra
[
:
len
(
header
.
Extra
)
-
65
],
// Yes, this will panic if extra is too short
header
.
MixDigest
,
header
.
Nonce
,
})
hasher
.
Sum
(
hash
[
:
0
])
return
hash
}
func
GetSigner
(
header
*
types
.
Header
)
(
signer
string
,
err
error
)
{
signature
:=
header
.
Extra
[
len
(
header
.
Extra
)
-
65
:
]
hash
:=
sigHash
(
header
)
.
Bytes
()
pubkey
,
err
:=
crypto
.
Ecrecover
(
hash
,
signature
)
address
:=
make
([]
byte
,
20
)
copy
(
address
,
crypto
.
Keccak256
(
pubkey
[
1
:
])[
12
:
])
signer
=
util
.
ToHex
(
address
)
return
}
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