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
9a057021
Commit
9a057021
authored
May 14, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update wallet value for coinbase rewards. Implements #44 & #43
parent
f18ec51c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
12 deletions
+31
-12
gui.go
ethereal/ui/gui.go
+29
-9
ethereum.go
ethereum/ethereum.go
+2
-3
No files found.
ethereal/ui/gui.go
View file @
9a057021
...
...
@@ -158,8 +158,29 @@ func (gui *Gui) processBlock(block *ethchain.Block) {
gui
.
win
.
Root
()
.
Call
(
"addBlock"
,
ethpub
.
NewPBlock
(
block
))
}
func
(
gui
*
Gui
)
setWalletValue
(
amount
,
unconfirmedFunds
*
big
.
Int
)
{
var
str
string
if
unconfirmedFunds
!=
nil
{
pos
:=
"+"
if
unconfirmedFunds
.
Cmp
(
big
.
NewInt
(
0
))
>=
0
{
pos
=
"-"
}
val
:=
ethutil
.
CurrencyToString
(
new
(
big
.
Int
)
.
Abs
(
ethutil
.
BigCopy
(
unconfirmedFunds
)))
str
=
fmt
.
Sprintf
(
"%v (%s %v)"
,
ethutil
.
CurrencyToString
(
amount
),
pos
,
val
)
}
else
{
str
=
fmt
.
Sprintf
(
"%v"
,
ethutil
.
CurrencyToString
(
amount
))
}
gui
.
win
.
Root
()
.
Call
(
"setWalletValue"
,
str
)
}
// Simple go routine function that updates the list of peers in the GUI
func
(
gui
*
Gui
)
update
()
{
blockChan
:=
make
(
chan
ethutil
.
React
,
1
)
reactor
:=
gui
.
eth
.
Reactor
()
reactor
.
Subscribe
(
"newBlock"
,
blockChan
)
txChan
:=
make
(
chan
ethchain
.
TxMsg
,
1
)
gui
.
eth
.
TxPool
()
.
Subscribe
(
txChan
)
...
...
@@ -170,6 +191,12 @@ func (gui *Gui) update() {
for
{
select
{
case
b
:=
<-
blockChan
:
block
:=
b
.
Resource
.
(
*
ethchain
.
Block
)
if
bytes
.
Compare
(
block
.
Coinbase
,
gui
.
addr
)
==
0
{
gui
.
setWalletValue
(
gui
.
eth
.
StateManager
()
.
ProcState
()
.
GetAccount
(
gui
.
addr
)
.
Amount
,
nil
)
}
case
txMsg
:=
<-
txChan
:
tx
:=
txMsg
.
Tx
...
...
@@ -191,14 +218,7 @@ func (gui *Gui) update() {
unconfirmedFunds
.
Add
(
unconfirmedFunds
,
tx
.
Value
)
}
pos
:=
"+"
if
unconfirmedFunds
.
Cmp
(
big
.
NewInt
(
0
))
>=
0
{
pos
=
"-"
}
val
:=
ethutil
.
CurrencyToString
(
new
(
big
.
Int
)
.
Abs
(
ethutil
.
BigCopy
(
unconfirmedFunds
)))
str
:=
fmt
.
Sprintf
(
"%v (%s %v)"
,
ethutil
.
CurrencyToString
(
object
.
Amount
),
pos
,
val
)
gui
.
win
.
Root
()
.
Call
(
"setWalletValue"
,
str
)
gui
.
setWalletValue
(
object
.
Amount
,
unconfirmedFunds
)
}
else
{
object
:=
state
.
GetAccount
(
gui
.
addr
)
if
bytes
.
Compare
(
tx
.
Sender
(),
gui
.
addr
)
==
0
{
...
...
@@ -207,7 +227,7 @@ func (gui *Gui) update() {
object
.
AddAmount
(
tx
.
Value
)
}
gui
.
win
.
Root
()
.
Call
(
"setWalletValue"
,
fmt
.
Sprintf
(
"%v"
,
ethutil
.
CurrencyToString
(
object
.
Amount
))
)
gui
.
setWalletValue
(
object
.
Amount
,
nil
)
state
.
SetStateObject
(
object
)
}
...
...
ethereum/ethereum.go
View file @
9a057021
...
...
@@ -66,10 +66,9 @@ func main() {
log
.
SetOutput
(
logfile
)
logSys
=
log
.
New
(
logfile
,
""
,
flags
)
logger
.
AddLogSystem
(
logSys
)
}
/*else {
}
else
{
logSys
=
log
.
New
(
os
.
Stdout
,
""
,
flags
)
}
*/
}
ethchain
.
InitFees
()
...
...
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