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
738d6e20
Commit
738d6e20
authored
Mar 09, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ui.Interface to xeth
parent
21fd722a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
15 deletions
+18
-15
frontend.go
ui/frontend.go
+4
-14
xeth.go
xeth/xeth.go
+14
-1
No files found.
ui/frontend.go
View file @
738d6e20
package
ui
// ReturnInterface is returned by the Intercom interface when a method is called
type
ReturnInterface
interface
{
Get
(
i
int
)
(
interface
{},
error
)
Size
()
int
}
import
"github.com/ethereum/go-ethereum/core/types"
// Frontend is the basic interface for calling arbitrary methods on something that
// implements a front end (GUI, CLI, etc)
type
Frontend
interface
{
// Checks whether a specific method is implemented
Supports
(
method
string
)
bool
// Call calls the given method on interface it implements. This will return
// an error with errNotImplemented if the method hasn't been implemented
// and will return a ReturnInterface if it does.
Call
(
method
string
)
(
ReturnInterface
,
error
)
type
Interface
interface
{
UnlockAccount
(
address
[]
byte
)
bool
ConfirmTransaction
(
tx
*
types
.
Transaction
)
bool
}
xeth/xeth.go
View file @
738d6e20
...
...
@@ -18,6 +18,7 @@ import (
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/ui"
"github.com/ethereum/go-ethereum/whisper"
)
...
...
@@ -46,9 +47,16 @@ type XEth struct {
state
*
State
whisper
*
Whisper
miner
*
miner
.
Miner
frontend
ui
.
Interface
}
func
New
(
eth
Backend
)
*
XEth
{
type
TmpFrontend
struct
{}
func
(
TmpFrontend
)
UnlockAccount
([]
byte
)
bool
{
panic
(
"UNLOCK ACCOUNT"
)
}
func
(
TmpFrontend
)
ConfirmTransaction
(
*
types
.
Transaction
)
bool
{
panic
(
"CONFIRM TRANSACTION"
)
}
func
New
(
eth
Backend
,
frontend
ui
.
Interface
)
*
XEth
{
xeth
:=
&
XEth
{
eth
:
eth
,
blockProcessor
:
eth
.
BlockProcessor
(),
...
...
@@ -56,6 +64,11 @@ func New(eth Backend) *XEth {
whisper
:
NewWhisper
(
eth
.
Whisper
()),
miner
:
eth
.
Miner
(),
}
if
frontend
==
nil
{
xeth
.
frontend
=
TmpFrontend
{}
}
xeth
.
state
=
NewState
(
xeth
,
xeth
.
chainManager
.
TransState
())
return
xeth
...
...
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