Add optional locktime parameter to CreateRawTransaction APIs.

This commit is contained in:
David Hill 2015-10-27 12:34:11 -04:00
parent 29a2544887
commit c56072017d

View file

@ -238,22 +238,22 @@ func (r FutureCreateRawTransactionResult) Receive() (*wire.MsgTx, error) {
//
// See CreateRawTransaction for the blocking version and more details.
func (c *Client) CreateRawTransactionAsync(inputs []btcjson.TransactionInput,
amounts map[btcutil.Address]btcutil.Amount) FutureCreateRawTransactionResult {
amounts map[btcutil.Address]btcutil.Amount, lockTime *int64) FutureCreateRawTransactionResult {
convertedAmts := make(map[string]float64, len(amounts))
for addr, amount := range amounts {
convertedAmts[addr.String()] = amount.ToBTC()
}
cmd := btcjson.NewCreateRawTransactionCmd(inputs, convertedAmts)
cmd := btcjson.NewCreateRawTransactionCmd(inputs, convertedAmts, lockTime)
return c.sendCmd(cmd)
}
// CreateRawTransaction returns a new transaction spending the provided inputs
// and sending to the provided addresses.
func (c *Client) CreateRawTransaction(inputs []btcjson.TransactionInput,
amounts map[btcutil.Address]btcutil.Amount) (*wire.MsgTx, error) {
amounts map[btcutil.Address]btcutil.Amount, lockTime *int64) (*wire.MsgTx, error) {
return c.CreateRawTransactionAsync(inputs, amounts).Receive()
return c.CreateRawTransactionAsync(inputs, amounts, lockTime).Receive()
}
// FutureSendRawTransactionResult is a future promise to deliver the result