From 84a8c0c008acf80a70c60dbfc0f5c3666abcd676 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 31 May 2016 14:13:02 +0200 Subject: Document some pitfalls in connection with "send". --- docs/types.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/types.rst') diff --git a/docs/types.rst b/docs/types.rst index 2cd3654b..6d4e928c 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -86,6 +86,12 @@ and to send Ether (in units of wei) to an address using the ``send`` function: .. note:: If ``x`` is a contract address, its code (more specifically: its fallback function, if present) will be executed together with the ``send`` call (this is a limitation of the EVM and cannot be prevented). If that execution runs out of gas or fails in any way, the Ether transfer will be reverted. In this case, ``send`` returns ``false``. +.. warning:: + There are some dangers in using ``send``: The transfer fails if the call stack depth is at 1023 + (this can always be forced by the caller) and it also fails if the recipient runs out of gas. So in order + to make safe Ether transfers, always check the return value of ``send`` or even better: + Use a pattern where the recipient withdraws the money. + * ``call``, ``callcode`` and ``delegatecall`` Furthermore, to interface with contracts that do not adhere to the ABI, -- cgit