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
bb3e2831
Commit
bb3e2831
authored
Feb 18, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If sender is receiver only subtract the fee
parent
a5b7279c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
transaction_pool.go
ethchain/transaction_pool.go
+15
-7
No files found.
ethchain/transaction_pool.go
View file @
bb3e2831
...
@@ -106,17 +106,25 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block) (err error
...
@@ -106,17 +106,25 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block) (err error
}
}
}
}
// Subtract the amount from the senders account
sender
.
Amount
.
Sub
(
sender
.
Amount
,
totAmount
)
sender
.
Nonce
+=
1
// Get the receiver
// Get the receiver
receiver
:=
block
.
GetAddr
(
tx
.
Recipient
)
receiver
:=
block
.
GetAddr
(
tx
.
Recipient
)
// Add the amount to receivers account which should conclude this transaction
sender
.
Nonce
+=
1
receiver
.
Amount
.
Add
(
receiver
.
Amount
,
tx
.
Value
)
// Send Tx to self
if
bytes
.
Compare
(
tx
.
Recipient
,
tx
.
Sender
())
==
0
{
// Subtract the fee
sender
.
Amount
.
Sub
(
sender
.
Amount
,
new
(
big
.
Int
)
.
Mul
(
TxFee
,
TxFeeRat
))
}
else
{
// Subtract the amount from the senders account
sender
.
Amount
.
Sub
(
sender
.
Amount
,
totAmount
)
// Add the amount to receivers account which should conclude this transaction
receiver
.
Amount
.
Add
(
receiver
.
Amount
,
tx
.
Value
)
block
.
UpdateAddr
(
tx
.
Recipient
,
receiver
)
}
block
.
UpdateAddr
(
tx
.
Sender
(),
sender
)
block
.
UpdateAddr
(
tx
.
Sender
(),
sender
)
block
.
UpdateAddr
(
tx
.
Recipient
,
receiver
)
return
return
}
}
...
...
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