[#5593] Disallow decimal wei value for gas price
Signed-off-by: Dmitry Novotochinov <dmitry.novot@gmail.com>
This commit is contained in:
parent
36c1a23e04
commit
ca149062ad
|
@ -16,7 +16,8 @@
|
|||
(defmethod invalid-send-parameter? :gas-price [_ value]
|
||||
(cond
|
||||
(not value) :invalid-number
|
||||
(< (money/->wei :gwei value) min-gas-price-wei) :not-enough-wei))
|
||||
(< (money/->wei :gwei value) min-gas-price-wei) :not-enough-wei
|
||||
(-> (money/->wei :gwei value) .decimalPlaces pos?) :invalid-number))
|
||||
|
||||
(defmethod invalid-send-parameter? :default [_ value]
|
||||
(when (or (not value)
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
(is (= "invalid" (get-in actual [:gas :value]))))
|
||||
(testing "it sets max-fee to 0"
|
||||
(is (= "0" (:max-fee actual))))))
|
||||
(testing "gas price in wei should be round"
|
||||
(let [actual (-> {}
|
||||
(model/build-edit :gas "21000")
|
||||
(model/build-edit :gas-price "0.0000000023"))]
|
||||
(is (get-in actual [:gas-price :invalid?]))))
|
||||
(testing "an valid edit"
|
||||
(let [actual (-> {}
|
||||
(model/build-edit :gas "21000")
|
||||
|
|
Loading…
Reference in New Issue