aboutsummaryrefslogtreecommitdiffstats
path: root/ethminer
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-28 18:06:09 +0800
committerobscuren <geffobscura@gmail.com>2014-05-28 18:06:09 +0800
commit9988b1a04710e03ce7ed4b23393e2e90f06889f9 (patch)
tree82551f1c24a74c960ab65d6dcd2da492498f08fe /ethminer
parent73761f7af64432b6946934c3b1db646d8e99ef07 (diff)
downloadgo-tangerine-9988b1a04710e03ce7ed4b23393e2e90f06889f9.tar
go-tangerine-9988b1a04710e03ce7ed4b23393e2e90f06889f9.tar.gz
go-tangerine-9988b1a04710e03ce7ed4b23393e2e90f06889f9.tar.bz2
go-tangerine-9988b1a04710e03ce7ed4b23393e2e90f06889f9.tar.lz
go-tangerine-9988b1a04710e03ce7ed4b23393e2e90f06889f9.tar.xz
go-tangerine-9988b1a04710e03ce7ed4b23393e2e90f06889f9.tar.zst
go-tangerine-9988b1a04710e03ce7ed4b23393e2e90f06889f9.zip
Sort transactions based on the nonce
* Added a transaction sorter
Diffstat (limited to 'ethminer')
-rw-r--r--ethminer/miner.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/ethminer/miner.go b/ethminer/miner.go
index 00e04cde2..9396d33f9 100644
--- a/ethminer/miner.go
+++ b/ethminer/miner.go
@@ -5,6 +5,7 @@ import (
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
+ "sort"
)
type Miner struct {
@@ -12,7 +13,7 @@ type Miner struct {
ethereum ethchain.EthManager
coinbase []byte
reactChan chan ethutil.React
- txs []*ethchain.Transaction
+ txs ethchain.Transactions
uncles []*ethchain.Block
block *ethchain.Block
powChan chan []byte
@@ -132,6 +133,8 @@ func (self *Miner) mineNewBlock() {
self.block.SetUncles(self.uncles)
}
+ // Sort the transactions by nonce in case of odd network propagation
+ sort.Sort(ethchain.TxByNonce{self.txs})
// Accumulate all valid transaction and apply them to the new state
receipts, txs := stateManager.ApplyTransactions(self.block.State(), self.block, self.txs)
self.txs = txs