Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
张蕾
Geth-Modification
Commits
815313c7
Commit
815313c7
authored
Jan 16, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added more opcodes
parent
fd7e79f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
2 deletions
+36
-2
block_manager.go
block_manager.go
+36
-2
No files found.
block_manager.go
View file @
815313c7
package
main
import
(
"bytes"
"errors"
"fmt"
"github.com/ethereum/ethutil-go"
"github.com/obscuren/secp256-go"
"log"
"math"
"math/big"
)
...
...
@@ -421,9 +424,40 @@ out:
// x = floor(10^21 / floor(diff^0.5))
bm
.
stack
.
Push
(
x
.
String
())
case
oSHA256
:
case
oRIPEMD160
:
case
oSHA256
,
oRIPEMD160
:
// This is probably save
// ceil(pop / 32)
length
:=
int
(
math
.
Ceil
(
float64
(
ethutil
.
Big
(
bm
.
stack
.
Pop
())
.
Uint64
())
/
32.0
))
// New buffer which will contain the concatenated popped items
data
:=
new
(
bytes
.
Buffer
)
for
i
:=
0
;
i
<
length
;
i
++
{
// Encode the number to bytes and have it 32bytes long
num
:=
ethutil
.
NumberToBytes
(
ethutil
.
Big
(
bm
.
stack
.
Pop
())
.
Bytes
(),
256
)
data
.
WriteString
(
string
(
num
))
}
if
op
==
oSHA256
{
bm
.
stack
.
Push
(
base
.
SetBytes
(
ethutil
.
Sha256Bin
(
data
.
Bytes
()))
.
String
())
}
else
{
bm
.
stack
.
Push
(
base
.
SetBytes
(
ethutil
.
Ripemd160
(
data
.
Bytes
()))
.
String
())
}
case
oECMUL
:
y
:=
bm
.
stack
.
Pop
()
x
:=
bm
.
stack
.
Pop
()
n
:=
bm
.
stack
.
Pop
()
if
ethutil
.
Big
(
x
)
.
Cmp
(
ethutil
.
Big
(
y
))
data
:=
new
(
bytes
.
Buffer
)
data
.
WriteString
(
x
)
data
.
WriteString
(
y
)
if
secp256
.
VerifyPubkeyValidity
(
data
.
Bytes
())
==
1
{
// TODO
}
else
{
// Invalid, push infinity
bm
.
stack
.
Push
(
"0"
)
bm
.
stack
.
Push
(
"0"
)
}
case
oECADD
:
case
oECSIGN
:
case
oECRECOVER
:
...
...
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