From: wz Date: Mon, 10 Jun 2019 06:40:28 +0000 (+0800) Subject: fix bug for cancel vote (#145) X-Git-Tag: v1.0.5~208^2~55 X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=commitdiff_plain;h=7b3ea85fe33bb69e747eebade63d3b4ccf539d1a;hp=4e50d5a8c598700df67e37117a9bd47ba42e5a17 fix bug for cancel vote (#145) --- diff --git a/account/builder.go b/account/builder.go index 027e1fbe..af0c0a1c 100644 --- a/account/builder.go +++ b/account/builder.go @@ -309,7 +309,12 @@ func (a *spendUTXOAction) Build(ctx context.Context, b *txbuilder.TemplateBuilde // UtxoToInputs convert an utxo to the txinput func UtxoToInputs(signer *signers.Signer, u *UTXO) (*types.TxInput, *txbuilder.SigningInstruction, error) { - txInput := types.NewSpendInput(nil, u.SourceID, u.AssetID, u.Amount, u.SourcePos, u.ControlProgram) + txInput := &types.TxInput{} + if u.Vote == nil { + txInput = types.NewSpendInput(nil, u.SourceID, u.AssetID, u.Amount, u.SourcePos, u.ControlProgram) + } else { + txInput = types.NewUnvoteInput(nil, u.SourceID, u.AssetID, u.Amount, u.SourcePos, u.ControlProgram, u.Vote) + } sigInst := &txbuilder.SigningInstruction{} if signer == nil { return txInput, sigInst, nil