From 03f6069579df8d3dc1e7298912ac7c75fdd11c9c Mon Sep 17 00:00:00 2001 From: Mawuli Adzoe Date: Sat, 25 Jul 2015 08:49:36 +0000 Subject: [PATCH] Update docs for NewAmount - Documentation update to NewAmount. Call out the fact it's specifically for converting BTC to Satoshi. The caller should perform a simple type cast to an Amount when dealing with int64 values which denote a quantity of Satoshi. --- amount.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/amount.go b/amount.go index 2598551..e2f057e 100644 --- a/amount.go +++ b/amount.go @@ -68,6 +68,11 @@ func round(f float64) Amount { // some value in bitcoin. NewAmount errors if f is NaN or +-Infinity, but // does not check that the amount is within the total amount of bitcoin // producible as f may not refer to an amount at a single moment in time. +// +// NewAmount is for specifically for converting BTC to Satoshi. +// For creating a new Amount with an int64 value which denotes a quantity of Satoshi, +// do a simple type conversion from type int64 to Amount. +// See GoDoc for example: http://godoc.org/github.com/btcsuite/btcutil#example-Amount func NewAmount(f float64) (Amount, error) { // The amount is only considered invalid if it cannot be represented // as an integer type. This may happen if f is NaN or +-Infinity.