| 189 | } |
| 190 | |
| 191 | func compareStateObjects(so0, so1 *stateObject, t *testing.T) { |
| 192 | if so0.Address() != so1.Address() { |
| 193 | t.Fatalf("Address mismatch: have %v, want %v", so0.address, so1.address) |
| 194 | } |
| 195 | if so0.Balance().Cmp(so1.Balance()) != 0 { |
| 196 | t.Fatalf("Balance mismatch: have %v, want %v", so0.Balance(), so1.Balance()) |
| 197 | } |
| 198 | if so0.Nonce() != so1.Nonce() { |
| 199 | t.Fatalf("Nonce mismatch: have %v, want %v", so0.Nonce(), so1.Nonce()) |
| 200 | } |
| 201 | if so0.data.Root != so1.data.Root { |
| 202 | t.Errorf("StateRoot mismatch: have %x, want %x", so0.data.Root[:], so1.data.Root[:]) |
| 203 | } |
| 204 | if !bytes.Equal(so0.CodeHash(), so1.CodeHash()) { |
| 205 | t.Fatalf("CodeHash mismatch: have %v, want %v", so0.CodeHash(), so1.CodeHash()) |
| 206 | } |
| 207 | if !bytes.Equal(so0.code, so1.code) { |
| 208 | t.Fatalf("Code mismatch: have %v, want %v", so0.code, so1.code) |
| 209 | } |
| 210 | |
| 211 | if len(so1.cachedStorage) != len(so0.cachedStorage) { |
| 212 | t.Errorf("Storage size mismatch: have %d, want %d", len(so1.cachedStorage), len(so0.cachedStorage)) |
| 213 | } |
| 214 | for k, v := range so1.cachedStorage { |
| 215 | if so0.cachedStorage[k] != v { |
| 216 | t.Errorf("Storage key %x mismatch: have %v, want %v", k, so0.cachedStorage[k], v) |
| 217 | } |
| 218 | } |
| 219 | for k, v := range so0.cachedStorage { |
| 220 | if so1.cachedStorage[k] != v { |
| 221 | t.Errorf("Storage key %x mismatch: have %v, want none.", k, v) |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | if so0.suicided != so1.suicided { |
| 226 | t.Fatalf("suicided mismatch: have %v, want %v", so0.suicided, so1.suicided) |
| 227 | } |
| 228 | if so0.deleted != so1.deleted { |
| 229 | t.Fatalf("Deleted mismatch: have %v, want %v", so0.deleted, so1.deleted) |
| 230 | } |
| 231 | } |