forked from evmos/ethermint
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: align empty account result for old blocks as ethereum (evmos#1484)…
… (#221) * align result account as ethereum * add test_get_transaction_count * add change doc * sync gomod2nix * Apply suggestions from code review * crosscheck with ws & geth * sync gomod2nix * Update rpc/backend/utils.go * use session provider Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from .utils import ADDRS, derive_new_account, w3_wait_for_new_blocks | ||
|
||
|
||
def test_get_transaction_count(ethermint_rpc_ws, geth): | ||
for p in [ethermint_rpc_ws, geth]: | ||
w3 = p.w3 | ||
blk = hex(w3.eth.block_number) | ||
sender = ADDRS["validator"] | ||
|
||
# derive a new address | ||
receiver = derive_new_account().address | ||
n0 = w3.eth.get_transaction_count(receiver, blk) | ||
# ensure transaction send in new block | ||
w3_wait_for_new_blocks(w3, 1, sleep=0.1) | ||
txhash = w3.eth.send_transaction( | ||
{ | ||
"from": sender, | ||
"to": receiver, | ||
"value": 1000, | ||
} | ||
) | ||
receipt = w3.eth.wait_for_transaction_receipt(txhash) | ||
assert receipt.status == 1 | ||
[n1, n2] = [w3.eth.get_transaction_count(receiver, b) for b in [blk, "latest"]] | ||
assert n0 == n1 | ||
assert n0 == n2 |