forked from Conflux-Chain/conflux-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnot_enough_gas_price_test.py
32 lines (25 loc) · 1.16 KB
/
not_enough_gas_price_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from conflux.rpc import RpcClient
from test_framework.test_framework import ConfluxTestFramework
from conflux.utils import priv_to_addr
from test_framework.util import *
from test_framework.mininode import *
class NotEnoughGasPrice(ConfluxTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.conf_parameters["tx_pool_min_native_tx_gas_price"] = 1_000_000_000
def run_test(self):
rpc = RpcClient(self.nodes[0])
priv_key = default_config["GENESIS_PRI_KEY"]
sender = eth_utils.encode_hex(priv_to_addr(priv_key))
tx = rpc.new_tx(receiver=sender, value=0, gas_price=1)
try:
rpc.send_tx(tx)
except jsonrpcclient.exceptions.ReceivedErrorResponseError as e:
r = e.response
assert_equal(r.code, -32602)
assert_equal(r.message, "Invalid parameters: tx \"transaction gas price 1 less than the minimum value 1000000000\"")
assert_equal(r.data, "\"transaction gas price 1 less than the minimum value 1000000000\"")
else:
raise AssertionError("Send transaction should fail")
if __name__ == "__main__":
NotEnoughGasPrice().main()