aboutsummaryrefslogtreecommitdiffstats
path: root/chain
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-03 05:22:43 +0800
committerobscuren <geffobscura@gmail.com>2014-12-03 05:22:43 +0800
commit0a22dc2ce5d0e69004272f44af972e387144c126 (patch)
tree16fda0eead6dec6e9480bdfc941764c2cb61e323 /chain
parentcb4d168ecc9f6c2ecdb1a8f3308f8f3eb9f02376 (diff)
downloaddexon-0a22dc2ce5d0e69004272f44af972e387144c126.tar
dexon-0a22dc2ce5d0e69004272f44af972e387144c126.tar.gz
dexon-0a22dc2ce5d0e69004272f44af972e387144c126.tar.bz2
dexon-0a22dc2ce5d0e69004272f44af972e387144c126.tar.lz
dexon-0a22dc2ce5d0e69004272f44af972e387144c126.tar.xz
dexon-0a22dc2ce5d0e69004272f44af972e387144c126.tar.zst
dexon-0a22dc2ce5d0e69004272f44af972e387144c126.zip
Check coinbase for from/to inclusion
Diffstat (limited to 'chain')
-rw-r--r--chain/block_manager.go17
-rw-r--r--chain/filter.go4
2 files changed, 13 insertions, 8 deletions
diff --git a/chain/block_manager.go b/chain/block_manager.go
index 9133475b6..fe84a94ca 100644
--- a/chain/block_manager.go
+++ b/chain/block_manager.go
@@ -275,16 +275,24 @@ func (sm *BlockManager) ProcessWithParent(block, parent *Block) (td *big.Int, me
}
}
-func (sm *BlockManager) ApplyDiff(state *state.State, parent, block *Block) (receipts Receipts, err error) {
- coinbase := state.GetOrNewStateObject(block.Coinbase)
+func (sm *BlockManager) ApplyDiff(statedb *state.State, parent, block *Block) (receipts Receipts, err error) {
+ coinbase := statedb.GetOrNewStateObject(block.Coinbase)
coinbase.SetGasPool(block.CalcGasLimit(parent))
// Process the transactions on to current block
- receipts, _, _, _, err = sm.ProcessTransactions(coinbase, state, block, parent, block.Transactions())
+ receipts, _, _, _, err = sm.ProcessTransactions(coinbase, statedb, block, parent, block.Transactions())
if err != nil {
return nil, err
}
+ statedb.Manifest().AddMessage(&state.Message{
+ To: block.Coinbase, From: block.Coinbase,
+ Input: nil,
+ Origin: nil,
+ Block: block.Hash(), Timestamp: block.Time, Coinbase: block.Coinbase, Number: block.Number,
+ Value: new(big.Int),
+ })
+
return receipts, nil
}
@@ -303,9 +311,6 @@ func (sm *BlockManager) CalculateTD(block *Block) (*big.Int, bool) {
// is greater than the previous.
if td.Cmp(sm.bc.TD) > 0 {
return td, true
-
- // Set the new total difficulty back to the block chain
- //sm.bc.SetTotalDifficulty(td)
}
return nil, false
diff --git a/chain/filter.go b/chain/filter.go
index 3c0b02d4f..5b7543167 100644
--- a/chain/filter.go
+++ b/chain/filter.go
@@ -175,7 +175,7 @@ func (self *Filter) bloomFilter(block *Block) bool {
var fromIncluded, toIncluded bool
if len(self.from) > 0 {
for _, from := range self.from {
- if BloomLookup(block.LogsBloom, from) {
+ if BloomLookup(block.LogsBloom, from) || bytes.Equal(block.Coinbase, from) {
fromIncluded = true
break
}
@@ -186,7 +186,7 @@ func (self *Filter) bloomFilter(block *Block) bool {
if len(self.to) > 0 {
for _, to := range self.to {
- if BloomLookup(block.LogsBloom, ethutil.U256(new(big.Int).Add(ethutil.Big1, ethutil.BigD(to))).Bytes()) {
+ if BloomLookup(block.LogsBloom, ethutil.U256(new(big.Int).Add(ethutil.Big1, ethutil.BigD(to))).Bytes()) || bytes.Equal(block.Coinbase, to) {
toIncluded = true
break
}