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
7fed4244
Commit
7fed4244
authored
May 05, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/geth: implemented resending transaction with different gas settings
parent
92f998c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
0 deletions
+83
-0
admin.go
cmd/geth/admin.go
+83
-0
No files found.
cmd/geth/admin.go
View file @
7fed4244
...
@@ -3,6 +3,7 @@ package main
...
@@ -3,6 +3,7 @@ package main
import
(
import
(
"errors"
"errors"
"fmt"
"fmt"
"strconv"
"time"
"time"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/cmd/utils"
...
@@ -22,6 +23,11 @@ node admin bindings
...
@@ -22,6 +23,11 @@ node admin bindings
*/
*/
func
(
js
*
jsre
)
adminBindings
()
{
func
(
js
*
jsre
)
adminBindings
()
{
ethO
,
_
:=
js
.
re
.
Get
(
"eth"
)
eth
:=
ethO
.
Object
()
eth
.
Set
(
"transactions"
,
js
.
transactions
)
eth
.
Set
(
"resend"
,
js
.
resend
)
js
.
re
.
Set
(
"admin"
,
struct
{}{})
js
.
re
.
Set
(
"admin"
,
struct
{}{})
t
,
_
:=
js
.
re
.
Get
(
"admin"
)
t
,
_
:=
js
.
re
.
Get
(
"admin"
)
admin
:=
t
.
Object
()
admin
:=
t
.
Object
()
...
@@ -74,6 +80,83 @@ func (js *jsre) getBlock(call otto.FunctionCall) (*types.Block, error) {
...
@@ -74,6 +80,83 @@ func (js *jsre) getBlock(call otto.FunctionCall) (*types.Block, error) {
return
nil
,
errors
.
New
(
"requires block number or block hash as argument"
)
return
nil
,
errors
.
New
(
"requires block number or block hash as argument"
)
}
}
type
tx
struct
{
tx
*
types
.
Transaction
To
string
From
string
Nonce
string
Value
string
Data
string
GasLimit
string
GasPrice
string
}
func
newTx
(
t
*
types
.
Transaction
)
*
tx
{
from
,
_
:=
t
.
From
()
var
to
string
if
t
:=
t
.
To
();
t
!=
nil
{
to
=
t
.
Hex
()
}
return
&
tx
{
tx
:
t
,
To
:
to
,
From
:
from
.
Hex
(),
Value
:
t
.
Amount
.
String
(),
Nonce
:
strconv
.
Itoa
(
int
(
t
.
Nonce
())),
Data
:
"0x"
+
common
.
Bytes2Hex
(
t
.
Data
()),
GasLimit
:
t
.
GasLimit
.
String
(),
GasPrice
:
t
.
GasPrice
()
.
String
(),
}
}
func
(
js
*
jsre
)
transactions
(
call
otto
.
FunctionCall
)
otto
.
Value
{
txs
:=
js
.
ethereum
.
TxPool
()
.
GetTransactions
()
ltxs
:=
make
([]
*
tx
,
len
(
txs
))
for
i
,
tx
:=
range
txs
{
ltxs
[
i
]
=
newTx
(
tx
)
}
return
js
.
re
.
ToVal
(
ltxs
)
}
func
(
js
*
jsre
)
resend
(
call
otto
.
FunctionCall
)
otto
.
Value
{
if
len
(
call
.
ArgumentList
)
==
0
{
fmt
.
Println
(
"first argument must be a transaction"
)
return
otto
.
FalseValue
()
}
v
,
err
:=
call
.
Argument
(
0
)
.
Export
()
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
otto
.
FalseValue
()
}
if
tx
,
ok
:=
v
.
(
*
tx
);
ok
{
gl
,
gp
:=
tx
.
GasLimit
,
tx
.
GasPrice
if
len
(
call
.
ArgumentList
)
>
1
{
gl
=
call
.
Argument
(
1
)
.
String
()
}
if
len
(
call
.
ArgumentList
)
>
2
{
gp
=
call
.
Argument
(
2
)
.
String
()
}
ret
,
err
:=
js
.
xeth
.
Transact
(
tx
.
From
,
tx
.
To
,
tx
.
Nonce
,
tx
.
Value
,
gl
,
gp
,
tx
.
Data
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
otto
.
FalseValue
()
}
js
.
ethereum
.
TxPool
()
.
RemoveTransactions
(
types
.
Transactions
{
tx
.
tx
})
return
js
.
re
.
ToVal
(
ret
)
}
fmt
.
Println
(
"first argument must be a transaction"
)
return
otto
.
FalseValue
()
}
func
(
js
*
jsre
)
debugBlock
(
call
otto
.
FunctionCall
)
otto
.
Value
{
func
(
js
*
jsre
)
debugBlock
(
call
otto
.
FunctionCall
)
otto
.
Value
{
block
,
err
:=
js
.
getBlock
(
call
)
block
,
err
:=
js
.
getBlock
(
call
)
if
err
!=
nil
{
if
err
!=
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