diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-09 22:37:04 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-09 22:37:04 +0800 |
commit | 0636e17dbee3accf6291000f0e4f4e713a97a207 (patch) | |
tree | 4ac363089495563f7d1ad983bdfa787299d979d2 | |
parent | c6b25a40464edcb3de992f016bcaef59bb75fa7e (diff) | |
download | dexon-0636e17dbee3accf6291000f0e4f4e713a97a207.tar dexon-0636e17dbee3accf6291000f0e4f4e713a97a207.tar.gz dexon-0636e17dbee3accf6291000f0e4f4e713a97a207.tar.bz2 dexon-0636e17dbee3accf6291000f0e4f4e713a97a207.tar.lz dexon-0636e17dbee3accf6291000f0e4f4e713a97a207.tar.xz dexon-0636e17dbee3accf6291000f0e4f4e713a97a207.tar.zst dexon-0636e17dbee3accf6291000f0e4f4e713a97a207.zip |
Added default registrar
-rw-r--r-- | cmd/geth/js.go | 1 | ||||
-rw-r--r-- | core/chain_manager.go | 10 |
2 files changed, 2 insertions, 9 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go index 59a8469fa..ec3b7a7ae 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -136,6 +136,7 @@ var net = web3.net; utils.Fatalf("Error setting namespaces: %v", err) } + js.re.Eval(registrar + "registrar = new Registrar(" + registrarAddr + ");") } func (self *jsre) ConfirmTransaction(tx *types.Transaction) bool { diff --git a/core/chain_manager.go b/core/chain_manager.go index 3ab95d272..9c66a9f53 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -50,15 +50,7 @@ func CalcDifficulty(block, parent *types.Header) *big.Int { } func CalculateTD(block, parent *types.Block) *big.Int { - uncleDiff := new(big.Int) - for _, uncle := range block.Uncles() { - uncleDiff = uncleDiff.Add(uncleDiff, uncle.Difficulty) - } - - // TD(genesis_block) = 0 and TD(B) = TD(B.parent) + sum(u.difficulty for u in B.uncles) + B.difficulty - td := new(big.Int) - td = td.Add(parent.Td, uncleDiff) - td = td.Add(td, block.Header().Difficulty) + td := new(big.Int).Add(parent.Td, block.Header().Difficulty) return td } |