good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
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
open
bor
Commits
61556ef0
Commit
61556ef0
authored
10 years ago
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
GasData changes & removed min gas price
parent
4cd9d57b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
chain/block.go
+14
-22
14 additions, 22 deletions
chain/block.go
chain/chain_manager.go
+0
-2
0 additions, 2 deletions
chain/chain_manager.go
chain/state_transition.go
+15
-3
15 additions, 3 deletions
chain/state_transition.go
miner/miner.go
+0
-1
0 additions, 1 deletion
miner/miner.go
with
29 additions
and
28 deletions
chain/block.go
+
14
−
22
View file @
61556ef0
...
...
@@ -84,8 +84,6 @@ type Block struct {
Time
int64
// The block number
Number
*
big
.
Int
// Minimum Gas Price
MinGasPrice
*
big
.
Int
// Gas limit
GasLimit
*
big
.
Int
// Gas used
...
...
@@ -124,16 +122,15 @@ func CreateBlock(root interface{},
extra
string
)
*
Block
{
block
:=
&
Block
{
PrevHash
:
prevHash
,
Coinbase
:
base
,
Difficulty
:
Difficulty
,
Nonce
:
Nonce
,
Time
:
time
.
Now
()
.
Unix
(),
Extra
:
extra
,
UncleSha
:
nil
,
GasUsed
:
new
(
big
.
Int
),
MinGasPrice
:
new
(
big
.
Int
),
GasLimit
:
new
(
big
.
Int
),
PrevHash
:
prevHash
,
Coinbase
:
base
,
Difficulty
:
Difficulty
,
Nonce
:
Nonce
,
Time
:
time
.
Now
()
.
Unix
(),
Extra
:
extra
,
UncleSha
:
nil
,
GasUsed
:
new
(
big
.
Int
),
GasLimit
:
new
(
big
.
Int
),
}
block
.
SetUncles
([]
*
Block
{})
...
...
@@ -300,12 +297,11 @@ func (self *Block) setHeader(header *ethutil.Value) {
self
.
LogsBloom
=
header
.
Get
(
6
)
.
Bytes
()
self
.
Difficulty
=
header
.
Get
(
7
)
.
BigInt
()
self
.
Number
=
header
.
Get
(
8
)
.
BigInt
()
self
.
MinGasPrice
=
header
.
Get
(
9
)
.
BigInt
()
self
.
GasLimit
=
header
.
Get
(
10
)
.
BigInt
()
self
.
GasUsed
=
header
.
Get
(
11
)
.
BigInt
()
self
.
Time
=
int64
(
header
.
Get
(
12
)
.
BigInt
()
.
Uint64
())
self
.
Extra
=
header
.
Get
(
13
)
.
Str
()
self
.
Nonce
=
header
.
Get
(
14
)
.
Bytes
()
self
.
GasLimit
=
header
.
Get
(
9
)
.
BigInt
()
self
.
GasUsed
=
header
.
Get
(
10
)
.
BigInt
()
self
.
Time
=
int64
(
header
.
Get
(
11
)
.
BigInt
()
.
Uint64
())
self
.
Extra
=
header
.
Get
(
12
)
.
Str
()
self
.
Nonce
=
header
.
Get
(
13
)
.
Bytes
()
}
func
NewUncleBlockFromValue
(
header
*
ethutil
.
Value
)
*
Block
{
...
...
@@ -351,8 +347,6 @@ func (block *Block) miningHeader() []interface{} {
block
.
Difficulty
,
// The block number
block
.
Number
,
// Block minimum gas price
block
.
MinGasPrice
,
// Block upper gas bound
block
.
GasLimit
,
// Block gas used
...
...
@@ -380,7 +374,6 @@ func (block *Block) String() string {
Bloom: %x
Difficulty: %v
Number: %v
MinGas: %v
MaxLimit: %v
GasUsed: %v
Time: %v
...
...
@@ -399,7 +392,6 @@ func (block *Block) String() string {
block
.
LogsBloom
,
block
.
Difficulty
,
block
.
Number
,
block
.
MinGasPrice
,
block
.
GasLimit
,
block
.
GasUsed
,
block
.
Time
,
...
...
This diff is collapsed.
Click to expand it.
chain/chain_manager.go
+
0
−
2
View file @
61556ef0
...
...
@@ -59,8 +59,6 @@ func (bc *ChainManager) NewBlock(coinbase []byte) *Block {
nil
,
""
)
block
.
MinGasPrice
=
big
.
NewInt
(
10000000000000
)
parent
:=
bc
.
CurrentBlock
if
parent
!=
nil
{
block
.
Difficulty
=
CalcDifficulty
(
block
,
parent
)
...
...
This diff is collapsed.
Click to expand it.
chain/state_transition.go
+
15
−
3
View file @
61556ef0
...
...
@@ -156,12 +156,24 @@ func (self *StateTransition) TransitionState() (err error) {
}
// Pay data gas
dataPrice
:=
big
.
NewInt
(
int64
(
len
(
self
.
data
)))
dataPrice
.
Mul
(
dataPrice
,
vm
.
GasData
)
if
err
=
self
.
UseGas
(
dataPrice
);
err
!=
nil
{
var
dgas
int64
for
_
,
byt
:=
range
self
.
data
{
if
byt
!=
0
{
dgas
+=
vm
.
GasData
.
Int64
()
}
else
{
dgas
+=
1
// This is 1/5. If GasData changes this fails
}
}
if
err
=
self
.
UseGas
(
big
.
NewInt
(
dgas
));
err
!=
nil
{
return
}
//dataPrice := big.NewInt(int64(len(self.data)))
//dataPrice.Mul(dataPrice, vm.GasData)
//if err = self.UseGas(dataPrice); err != nil {
// return
//}
if
sender
.
Balance
()
.
Cmp
(
self
.
value
)
<
0
{
return
fmt
.
Errorf
(
"Insufficient funds to transfer value. Req %v, has %v"
,
self
.
value
,
sender
.
Balance
)
}
...
...
This diff is collapsed.
Click to expand it.
miner/miner.go
+
0
−
1
View file @
61556ef0
...
...
@@ -177,7 +177,6 @@ func (self *Miner) mine() {
chainMan
=
self
.
eth
.
ChainManager
()
block
=
chainMan
.
NewBlock
(
self
.
Coinbase
)
)
block
.
MinGasPrice
=
self
.
MinAcceptedGasPrice
// Apply uncles
if
len
(
self
.
uncles
)
>
0
{
...
...
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