Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
vctt94 committed Oct 16, 2018
1 parent cf0ff09 commit 01b1872
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion rpc/legacyrpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ func fundRawTransaction(s *Server, icmd interface{}) (interface{}, error) {
}
resp := &dcrjson.FundRawTransactionResult{
Hex: hex.EncodeToString(buf.Bytes()),
Fee: float64(totalInputValue - totalOutputValue),
Fee: float64(totalInputValue-totalOutputValue) / 1e8,
}

return resp, nil
Expand Down
3 changes: 0 additions & 3 deletions wallet/createtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package wallet
import (
"context"
"encoding/binary"
"fmt"
"time"

"github.com/decred/dcrd/blockchain"
Expand Down Expand Up @@ -177,8 +176,6 @@ func (w *Wallet) FundRawTransaction(tx wire.MsgTx, relayFeePerKb dcrutil.Amount,
sourceImpl := w.TxStore.MakeInputSource(txmgrNs, addrmgrNs, account,
minConf, tipHeight)

fmt.Printf("sourceImpl: %+v\n\n", sourceImpl)

if changeAddress == nil {
changeSource := p2PKHChangeSource{
persist: w.deferPersistReturnedChild(&changeSourceUpdates),
Expand Down
18 changes: 6 additions & 12 deletions wallet/txauthor/author.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,9 @@ func FundRawTransaction(mtx wire.MsgTx, relayFeePerKb dcrutil.Amount,
targetFee = maxRequiredFee
continue
}
txInputs := append(inputs, inputDetail.Inputs...)
fundedTransaction := &wire.MsgTx{
SerType: wire.TxSerializeFull,
Version: generatedTxVersion,
TxIn: txInputs,
TxOut: outputs,
LockTime: 0,
Expiry: 0,
}
txInputs := append(mtx.TxIn, inputDetail.Inputs...)
mtx.TxIn = txInputs

changeAmount := inputDetail.Amount - targetAmount - maxRequiredFee
if changeAmount != 0 && !txrules.IsDustAmount(changeAmount,
changeScriptSize, relayFeePerKb) {
Expand All @@ -220,12 +214,12 @@ func FundRawTransaction(mtx wire.MsgTx, relayFeePerKb dcrutil.Amount,
PkScript: changeScript,
}
l := len(outputs)
fundedTransaction.TxOut = append(outputs[:l:l], change)
mtx.TxOut = append(outputs[:l:l], change)
} else {
maxSignedSize = txsizes.EstimateSerializeSize(scriptSizes,
fundedTransaction.TxOut, 0)
mtx.TxOut, 0)
}
return fundedTransaction, nil
return &mtx, nil
}
}

Expand Down

0 comments on commit 01b1872

Please sign in to comment.