small fix of utxo calculation on raw transaction build (#126)
* small fixes * gofmt * fix in raw tx build * fixes after review
This commit is contained in:
parent
a058598ecc
commit
a5e2df6942
1 changed files with 4 additions and 2 deletions
|
@ -48,8 +48,10 @@ func CreateRawContractTransaction(params ContractTxParams) (*transaction.Transac
|
|||
tx.AddInput(&input)
|
||||
}
|
||||
|
||||
senderOutput = transaction.NewOutput(assetID, spent-amount, fromAddressHash)
|
||||
tx.AddOutput(senderOutput)
|
||||
if senderUnspent := spent - amount; senderUnspent > 0 {
|
||||
senderOutput = transaction.NewOutput(assetID, senderUnspent, fromAddressHash)
|
||||
tx.AddOutput(senderOutput)
|
||||
}
|
||||
receiverOutput = transaction.NewOutput(assetID, amount, toAddressHash)
|
||||
tx.AddOutput(receiverOutput)
|
||||
|
||||
|
|
Loading…
Reference in a new issue