Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
86ba7432
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
86ba7432
编写于
4月 01, 2015
作者:
T
Taylor Gerring
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
txMeta storage as struct
上级
b860b676
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
25 addition
and
30 deletion
+25
-30
core/block_processor.go
core/block_processor.go
+11
-17
xeth/xeth.go
xeth/xeth.go
+14
-13
未找到文件。
core/block_processor.go
浏览文件 @
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
uint64
)
{
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
),
rlpEnc
)
db
.
Put
(
append
(
tx
.
Hash
()
.
Bytes
(),
0x000
1
),
rlpMeta
)
}
}
xeth/xeth.go
浏览文件 @
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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录