Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parity-test-sync
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
parity
parity-test-sync
Commits
fea41870
Commit
fea41870
authored
9 years ago
by
Gav Wood
Browse files
Options
Downloads
Patches
Plain Diff
Better API allowing one fewer clone.
parent
2cc3ee66
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/block.rs
+10
-8
10 additions, 8 deletions
src/block.rs
src/ethereum/ethash.rs
+1
-2
1 addition, 2 deletions
src/ethereum/ethash.rs
with
11 additions
and
10 deletions
src/block.rs
+
10
−
8
View file @
fea41870
...
...
@@ -8,14 +8,6 @@ pub struct Entry {
receipt
:
Receipt
,
}
/// A set of fields that are publicly alterable.
pub
struct
BlockRefMut
<
'a
>
{
pub
header
:
&
'a
Header
,
pub
state
:
&
'a
mut
State
,
pub
archive
:
&
'a
Vec
<
Entry
>
,
pub
uncles
:
&
'a
Vec
<
Header
>
,
}
/// Internal type for a block's common elements.
pub
struct
Block
{
header
:
Header
,
...
...
@@ -29,7 +21,16 @@ pub struct Block {
uncles
:
Vec
<
Header
>
,
}
/// A set of references to `Block` fields that are publicly accessible.
pub
struct
BlockRefMut
<
'a
>
{
pub
header
:
&
'a
Header
,
pub
state
:
&
'a
mut
State
,
pub
archive
:
&
'a
Vec
<
Entry
>
,
pub
uncles
:
&
'a
Vec
<
Header
>
,
}
impl
Block
{
/// Create a new block from the given `state`.
fn
new
(
state
:
State
)
->
Block
{
Block
{
header
:
Header
::
new
(),
...
...
@@ -40,6 +41,7 @@ impl Block {
}
}
/// Get a structure containing individual references to all public fields.
pub
fn
fields
(
&
mut
self
)
->
BlockRefMut
{
BlockRefMut
{
header
:
&
self
.header
,
...
...
This diff is collapsed.
Click to expand it.
src/ethereum/ethash.rs
+
1
−
2
View file @
fea41870
...
...
@@ -24,8 +24,7 @@ impl Engine for Ethash {
fn
on_close_block
(
&
self
,
block
:
&
mut
Block
)
{
let
reward
=
self
.spec
()
.engine_params
.get
(
"blockReward"
)
.map
(|
a
|
decode
(
&
a
))
.unwrap_or
(
U256
::
from
(
0u64
));
let
fields
=
block
.fields
();
let
author
=
&
fields
.header.author
;
fields
.state
.add_balance
(
author
,
&
reward
);
fields
.state
.add_balance
(
&
fields
.header.author
,
&
reward
);
/*
let uncle_authors = block.uncles.iter().map(|u| u.author().clone()).collect();
for a in uncle_authors {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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