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.
This commit is contained in:
parent
1c7f05922f
commit
03f6069579
1 changed files with 5 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue