From 9e60210f184472dda8f961c896bdd0747691c481 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Mon, 7 Jul 2014 09:05:17 -0500 Subject: [PATCH] Update for untyped btcutil consts. ok @davecgh --- mining.go | 8 ++++---- rpcserver.go | 6 +++--- util/btcctl/btcctl.go | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mining.go b/mining.go index b87613e9..95c7bec1 100644 --- a/mining.go +++ b/mining.go @@ -28,7 +28,7 @@ const ( // minHighPriority is the minimum priority value that allows a // transaction to be considered high priority. - minHighPriority = btcutil.SatoshiPerBitcoin * 144 / 250 + minHighPriority = btcutil.SatoshiPerBitcoin * 144.0 / 250 // blockHeaderOverhead is the max number of bytes it takes to serialize // a block header and max possible transaction count. @@ -666,13 +666,13 @@ mempoolLoop: // the priority size or there are no more high-priority // transactions. if !sortedByFee && (blockPlusTxSize >= cfg.BlockPrioritySize || - prioItem.priority <= float64(minHighPriority)) { + prioItem.priority <= minHighPriority) { minrLog.Tracef("Switching to sort by fees per "+ "kilobyte blockSize %d >= BlockPrioritySize "+ "%d || priority %.2f <= minHighPriority %.2f", blockPlusTxSize, cfg.BlockPrioritySize, - prioItem.priority, float64(minHighPriority)) + prioItem.priority, minHighPriority) sortedByFee = true priorityQueue.SetLessFunc(txPQByFee) @@ -684,7 +684,7 @@ mempoolLoop: // final one in the high-priority section, so just fall // though to the code below so it is added now. if blockPlusTxSize > cfg.BlockPrioritySize || - prioItem.priority < float64(minHighPriority) { + prioItem.priority < minHighPriority { heap.Push(priorityQueue, prioItem) continue diff --git a/rpcserver.go b/rpcserver.go index 420e5d87..7235b18a 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -802,7 +802,7 @@ func createVoutList(mtx *btcwire.MsgTx, net *btcnet.Params) ([]btcjson.Vout, err voutList := make([]btcjson.Vout, len(mtx.TxOut)) for i, v := range mtx.TxOut { voutList[i].N = uint32(i) - voutList[i].Value = float64(v.Value) / float64(btcutil.SatoshiPerBitcoin) + voutList[i].Value = float64(v.Value) / btcutil.SatoshiPerBitcoin disbuf, err := btcscript.DisasmString(v.PkScript) if err != nil { @@ -1265,7 +1265,7 @@ func handleGetInfo(s *rpcServer, cmd btcjson.Cmd, closeChan <-chan struct{}) (in Proxy: cfg.Proxy, Difficulty: getDifficultyRatio(blkHeader.Bits), TestNet: cfg.TestNet3, - RelayFee: float64(minTxRelayFee) / float64(btcutil.SatoshiPerBitcoin), + RelayFee: float64(minTxRelayFee) / btcutil.SatoshiPerBitcoin, } return ret, nil @@ -1446,7 +1446,7 @@ func handleGetRawMempool(s *rpcServer, cmd btcjson.Cmd, closeChan <-chan struct{ mpd := &btcjson.GetRawMempoolResult{ Size: int32(desc.Tx.MsgTx().SerializeSize()), Fee: float64(desc.Fee) / - float64(btcutil.SatoshiPerBitcoin), + btcutil.SatoshiPerBitcoin, Time: desc.Added.Unix(), Height: desc.Height, StartingPriority: 0, // We don't mine. diff --git a/util/btcctl/btcctl.go b/util/btcctl/btcctl.go index c6e3934a..d5dd10f4 100644 --- a/util/btcctl/btcctl.go +++ b/util/btcctl/btcctl.go @@ -129,7 +129,7 @@ func toSatoshi(val string) (interface{}, error) { if err != nil { return nil, err } - return int64(float64(btcutil.SatoshiPerBitcoin) * idx), nil + return int64(btcutil.SatoshiPerBitcoin * idx), nil } // toInt attempts to convert the passed string to an integer. It returns the @@ -720,7 +720,7 @@ func makeSendMany(args []interface{}) (btcjson.Cmd, error) { } pairs := make(map[string]int64) for addr, value := range origPairs { - pairs[addr] = int64(float64(btcutil.SatoshiPerBitcoin) * value) + pairs[addr] = int64(btcutil.SatoshiPerBitcoin * value) } var optargs = make([]interface{}, 0, 2)