From f5d441473499428964b75924845cf0c7bcaaa5ca Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 20 May 2014 14:41:35 +0200 Subject: [PATCH 1/2] Fix notification when processing block that didn't have this client as origin --- ethchain/state_manager.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go index 098263e8ad..c7c6857d83 100644 --- a/ethchain/state_manager.go +++ b/ethchain/state_manager.go @@ -180,6 +180,7 @@ func (sm *StateManager) ProcessBlock(state *State, block *Block, dontReact bool) // Add the block to the chain sm.bc.Add(block) + sm.notifyChanges(state) ethutil.Config.Log.Infof("[STATE] Added block #%d (%x)\n", block.BlockInfo().Number, block.Hash()) if dontReact == false { @@ -188,8 +189,6 @@ func (sm *StateManager) ProcessBlock(state *State, block *Block, dontReact bool) state.manifest.Reset() } - sm.notifyChanges(state) - sm.Ethereum.Broadcast(ethwire.MsgBlockTy, []interface{}{block.Value().Val}) sm.Ethereum.TxPool().RemoveInvalid(state) From 31e44c2ab959124cbcf2de45385373b9898727bc Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 20 May 2014 14:53:34 +0200 Subject: [PATCH 2/2] Change shorthands --- ethutil/common.go | 26 +++++++++++++------------- ethutil/common_test.go | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ethutil/common.go b/ethutil/common.go index 983ea5d1bc..771dfc723c 100644 --- a/ethutil/common.go +++ b/ethutil/common.go @@ -7,13 +7,13 @@ import ( // The different number of units var ( - Ether = BigPow(10, 18) - Finney = BigPow(10, 15) - Szabo = BigPow(10, 12) - Vita = BigPow(10, 9) - Turing = BigPow(10, 6) - Eins = BigPow(10, 3) - Wei = big.NewInt(1) + Ether = BigPow(10, 18) + Finney = BigPow(10, 15) + Szabo = BigPow(10, 12) + Shannon = BigPow(10, 9) + Babbage = BigPow(10, 6) + Ada = BigPow(10, 3) + Wei = big.NewInt(1) ) // Currency to string @@ -27,12 +27,12 @@ func CurrencyToString(num *big.Int) string { return fmt.Sprintf("%v Finney", new(big.Int).Div(num, Finney)) case num.Cmp(Szabo) >= 0: return fmt.Sprintf("%v Szabo", new(big.Int).Div(num, Szabo)) - case num.Cmp(Vita) >= 0: - return fmt.Sprintf("%v Vita", new(big.Int).Div(num, Vita)) - case num.Cmp(Turing) >= 0: - return fmt.Sprintf("%v Turing", new(big.Int).Div(num, Turing)) - case num.Cmp(Eins) >= 0: - return fmt.Sprintf("%v Eins", new(big.Int).Div(num, Eins)) + case num.Cmp(Shannon) >= 0: + return fmt.Sprintf("%v Shannon", new(big.Int).Div(num, Shannon)) + case num.Cmp(Babbage) >= 0: + return fmt.Sprintf("%v Babbage", new(big.Int).Div(num, Babbage)) + case num.Cmp(Ada) >= 0: + return fmt.Sprintf("%v Ada", new(big.Int).Div(num, Ada)) } return fmt.Sprintf("%v Wei", num) diff --git a/ethutil/common_test.go b/ethutil/common_test.go index 8031f08ab5..2667eaf3af 100644 --- a/ethutil/common_test.go +++ b/ethutil/common_test.go @@ -26,15 +26,15 @@ func TestCommon(t *testing.T) { t.Error("Got", szabo) } - if vito != "10 Vita" { + if vito != "10 Shannon" { t.Error("Got", vito) } - if turing != "10 Turing" { + if turing != "10 Babbage" { t.Error("Got", turing) } - if eins != "10 Eins" { + if eins != "10 Ada" { t.Error("Got", eins) }