Created
February 19, 2017 18:20
-
-
Save RCasatta/34015ed2d8b1b8e73d8e7d528f76fce6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from ethereum import trie, db, utils | |
| import rlp | |
| # Block number 233481 | |
| # hash 0xccc6da94c2f8d222ef723db7c0469fb54790d30c31c4c176837570953a11d4b5 | |
| # tx hash root 0x94855872b7fee469b12577beb875a3ad65b479a216cbbaf9f23ab1277393b084 | |
| # contain one tx with hash 0x0d3789c1341c2edb92429f8e8f669f057be5bad2b5dba9ac52069e5b2535e696 | |
| # whose content is 0xf86f824ed5850ba43b740083015f90941df99e975f2e6c2e6945cda3a377552cb582caf688477a615df3b28800801ca09e43bb22f0458d7f3025dfa01e9f223743f8dae2c7b11070529dc2733358f0fba07bfe8c286d21839d153733328d8f48e7e7b3fe79c2f31fd2bf992b2381980f48 | |
| tx = 'f86f824ed5850ba43b740083015f90941df99e975f2e6c2e6945cda3a377552cb582caf688477a615df3b28800801ca09e43bb22f0458d7f3025dfa01e9f223743f8dae2c7b11070529dc2733358f0fba07bfe8c286d21839d153733328d8f48e7e7b3fe79c2f31fd2bf992b2381980f48'.decode('hex') | |
| txhash = utils.sha3(tx) | |
| assert '0d3789c1341c2edb92429f8e8f669f057be5bad2b5dba9ac52069e5b2535e696' == txhash.encode('hex') | |
| state = trie.Trie(db.DB(), trie.BLANK_ROOT) | |
| assert '56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421' == state.root_hash.encode('hex') # empty trie root hash | |
| state.update(rlp.encode(0), rlp.encode(tx)) | |
| root = state.root_hash.encode('hex') | |
| print root | |
| assert '94855872b7fee469b12577beb875a3ad65b479a216cbbaf9f23ab1277393b084' == root # THIS FAILS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment