Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
8f3a0989
Commit
8f3a0989
authored
Sep 25, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix transaction order
parent
1495f490
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
13 deletions
+17
-13
main.go
minigeth/main.go
+15
-9
prefetch.go
minigeth/oracle/prefetch.go
+1
-1
preimage.go
minigeth/oracle/preimage.go
+1
-3
No files found.
minigeth/main.go
View file @
8f3a0989
...
...
@@ -20,6 +20,12 @@ import (
"github.com/ethereum/go-ethereum/trie"
)
func
check
(
err
error
)
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
}
func
main
()
{
// init secp256k1BytePoints
crypto
.
S256
()
...
...
@@ -38,10 +44,7 @@ func main() {
// read start block header
var
parent
types
.
Header
rlperr
:=
rlp
.
DecodeBytes
(
oracle
.
Preimage
(
oracle
.
Input
(
0
)),
&
parent
)
if
rlperr
!=
nil
{
log
.
Fatal
(
rlperr
)
}
check
(
rlp
.
DecodeBytes
(
oracle
.
Preimage
(
oracle
.
Input
(
0
)),
&
parent
))
// read header
var
newheader
types
.
Header
...
...
@@ -74,14 +77,17 @@ func main() {
tt
,
_
:=
trie
.
New
(
newheader
.
TxHash
,
&
triedb
)
tni
:=
tt
.
NodeIterator
([]
byte
{})
for
tni
.
Next
(
true
)
{
fmt
.
Println
(
tni
.
Hash
(),
tni
.
Leaf
(),
tni
.
Path
(),
tni
.
Error
())
//
fmt.Println(tni.Hash(), tni.Leaf(), tni.Path(), tni.Error())
if
tni
.
Leaf
()
{
tx
:=
types
.
Transaction
{}
lerr
:=
tx
.
UnmarshalBinary
(
tni
.
LeafBlob
())
if
lerr
!=
nil
{
log
.
Fatal
(
lerr
)
var
rlpKey
uint64
check
(
rlp
.
DecodeBytes
(
tni
.
LeafKey
(),
&
rlpKey
))
check
(
tx
.
UnmarshalBinary
(
tni
.
LeafBlob
()))
// TODO: resize an array in go?
for
uint64
(
len
(
txs
))
<=
rlpKey
{
txs
=
append
(
txs
,
nil
)
}
txs
=
append
(
txs
,
&
tx
)
txs
[
rlpKey
]
=
&
tx
}
}
fmt
.
Println
(
"read"
,
len
(
txs
),
"transactions"
)
...
...
minigeth/oracle/prefetch.go
View file @
8f3a0989
...
...
@@ -247,7 +247,7 @@ func PrefetchBlock(blockNumber *big.Int, startBlock bool, hasher types.TrieHashe
txs
:=
make
([]
*
types
.
Transaction
,
len
(
jr
.
Result
.
Transactions
))
for
i
:=
0
;
i
<
len
(
jr
.
Result
.
Transactions
);
i
++
{
txs
[
i
]
=
jr
.
Result
.
Transactions
[
i
]
.
ToTransaction
()
fmt
.
Println
(
"tx"
,
i
,
"hash"
,
txs
[
i
]
.
Hash
())
//
fmt.Println("tx", i, "hash", txs[i].Hash())
}
testTxHash
:=
types
.
DeriveSha
(
types
.
Transactions
(
txs
),
hasher
)
if
testTxHash
!=
blockHeader
.
TxHash
{
...
...
minigeth/oracle/preimage.go
View file @
8f3a0989
...
...
@@ -41,9 +41,7 @@ func (kw PreimageKeyValueWriter) Put(key []byte, value []byte) error {
if
hash
!=
common
.
BytesToHash
(
key
)
{
panic
(
"bad preimage value write"
)
}
nval
:=
make
([]
byte
,
len
(
value
))
copy
(
nval
,
value
)
preimages
[
hash
]
=
nval
preimages
[
hash
]
=
common
.
CopyBytes
(
value
)
//fmt.Println("tx preimage", hash, common.Bytes2Hex(value))
return
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment