wire: remove towire_double()

Before this patch we used to send `double`s over the wire by just
copying them. This is not portable because the internal represenation
of a `double` is implementation specific.

Instead of this, multiply any floating-point numbers that come from
the outside (e.g. JSONs) by 1 million and round them to integers when
handling them.

* Introduce a new param_millionths() that expects a floating-point
  number and returns it multipled by 1000000 as an integer.

* Replace param_double() and param_percent() with param_millionths()

* Previously the riskfactor would be allowed to be negative, which must
  have been unintentional. This patch changes that to require a
  non-negative number.

Changelog-None
This commit is contained in:
Vasil Dimov
2020-01-29 12:30:00 +01:00
committed by Rusty Russell
parent 6b7db1ea7c
commit 89ceb273f5
13 changed files with 124 additions and 137 deletions

View File

@@ -199,7 +199,6 @@ class Type(FieldSet):
'secp256k1_ecdsa_signature',
'secp256k1_ecdsa_recoverable_signature',
'wirestring',
'double',
'errcode_t',
'bigsize',
'varint',