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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
86ba7432
Commit
86ba7432
authored
Apr 1, 2015
by
Taylor Gerring
Browse files
Options
Downloads
Patches
Plain Diff
txMeta storage as struct
parent
b860b676
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/block_processor.go
+11
-17
11 additions, 17 deletions
core/block_processor.go
xeth/xeth.go
+14
-13
14 additions, 13 deletions
xeth/xeth.go
with
25 additions
and
30 deletions
core/block_processor.go
+
11
−
17
View file @
86ba7432
...
@@ -235,7 +235,7 @@ func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (td *big
...
@@ -235,7 +235,7 @@ func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (td *big
// This puts transactions in a extra db for rpc
// This puts transactions in a extra db for rpc
for
i
,
tx
:=
range
block
.
Transactions
()
{
for
i
,
tx
:=
range
block
.
Transactions
()
{
putTx
(
sm
.
extraDb
,
tx
,
block
,
i
)
putTx
(
sm
.
extraDb
,
tx
,
block
,
uint64
(
i
)
)
}
}
if
uncle
{
if
uncle
{
...
@@ -359,7 +359,7 @@ func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err erro
...
@@ -359,7 +359,7 @@ func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err erro
return
state
.
Logs
(),
nil
return
state
.
Logs
(),
nil
}
}
func
putTx
(
db
common
.
Database
,
tx
*
types
.
Transaction
,
block
*
types
.
Block
,
i
int
)
{
func
putTx
(
db
common
.
Database
,
tx
*
types
.
Transaction
,
block
*
types
.
Block
,
i
u
int
64
)
{
rlpEnc
,
err
:=
rlp
.
EncodeToBytes
(
tx
)
rlpEnc
,
err
:=
rlp
.
EncodeToBytes
(
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
statelogger
.
Infoln
(
"Failed encoding tx"
,
err
)
statelogger
.
Infoln
(
"Failed encoding tx"
,
err
)
...
@@ -367,24 +367,18 @@ func putTx(db common.Database, tx *types.Transaction, block *types.Block, i int)
...
@@ -367,24 +367,18 @@ func putTx(db common.Database, tx *types.Transaction, block *types.Block, i int)
}
}
db
.
Put
(
tx
.
Hash
()
.
Bytes
(),
rlpEnc
)
db
.
Put
(
tx
.
Hash
()
.
Bytes
(),
rlpEnc
)
rlpEnc
,
err
=
rlp
.
EncodeToBytes
(
block
.
Hash
()
.
Bytes
())
var
txExtra
struct
{
if
err
!=
nil
{
BlockHash
common
.
Hash
statelogger
.
Infoln
(
"Failed encoding meta"
,
err
)
BlockIndex
uint64
return
Index
uint64
}
}
db
.
Put
(
append
(
tx
.
Hash
()
.
Bytes
(),
0x0001
),
rlpEnc
)
txExtra
.
BlockHash
=
block
.
Hash
()
txExtra
.
BlockIndex
=
block
.
NumberU64
()
rlpEnc
,
err
=
rlp
.
EncodeToBytes
(
block
.
Number
()
.
Bytes
())
txExtra
.
Index
=
i
if
err
!=
nil
{
rlpMeta
,
err
:=
rlp
.
EncodeToBytes
(
txExtra
)
statelogger
.
Infoln
(
"Failed encoding meta"
,
err
)
return
}
db
.
Put
(
append
(
tx
.
Hash
()
.
Bytes
(),
0x0002
),
rlpEnc
)
rlpEnc
,
err
=
rlp
.
EncodeToBytes
(
i
)
if
err
!=
nil
{
if
err
!=
nil
{
statelogger
.
Infoln
(
"Failed encoding meta"
,
err
)
statelogger
.
Infoln
(
"Failed encoding meta"
,
err
)
return
return
}
}
db
.
Put
(
append
(
tx
.
Hash
()
.
Bytes
(),
0x000
3
),
rlp
Enc
)
db
.
Put
(
append
(
tx
.
Hash
()
.
Bytes
(),
0x000
1
),
rlp
Meta
)
}
}
This diff is collapsed.
Click to expand it.
xeth/xeth.go
+
14
−
13
View file @
86ba7432
...
@@ -19,6 +19,7 @@ import (
...
@@ -19,6 +19,7 @@ import (
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/rlp"
)
)
var
(
var
(
...
@@ -191,20 +192,20 @@ func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blha
...
@@ -191,20 +192,20 @@ func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blha
tx
=
types
.
NewTransactionFromBytes
(
data
)
tx
=
types
.
NewTransactionFromBytes
(
data
)
}
}
// blockhash
// meta
data
,
_
=
self
.
backend
.
ExtraDb
()
.
Get
(
append
(
common
.
FromHex
(
hash
),
0x0001
))
var
txExtra
struct
{
if
len
(
data
)
!=
0
{
BlockHash
common
.
Hash
blhash
=
common
.
BytesToHash
(
data
)
BlockIndex
int64
}
Index
uint64
// blocknum
data
,
_
=
self
.
backend
.
ExtraDb
()
.
Get
(
append
(
common
.
FromHex
(
hash
),
0x0002
))
if
len
(
data
)
!=
0
{
blnum
=
common
.
Bytes2Big
(
data
)
}
}
// txindex
data
,
_
=
self
.
backend
.
ExtraDb
()
.
Get
(
append
(
common
.
FromHex
(
hash
),
0x0003
))
v
,
_
:=
self
.
backend
.
ExtraDb
()
.
Get
(
append
(
common
.
FromHex
(
hash
),
0x0001
))
if
len
(
data
)
!=
0
{
r
:=
bytes
.
NewReader
(
v
)
txi
=
common
.
BytesToNumber
(
data
)
err
:=
rlp
.
Decode
(
r
,
&
txExtra
)
if
err
==
nil
{
blhash
=
txExtra
.
BlockHash
blnum
=
big
.
NewInt
(
txExtra
.
BlockIndex
)
txi
=
txExtra
.
Index
}
}
return
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