From 7b3ea85fe33bb69e747eebade63d3b4ccf539d1a Mon Sep 17 00:00:00 2001 From: wz Date: Mon, 10 Jun 2019 14:40:28 +0800 Subject: [PATCH] fix bug for cancel vote (#145) --- account/builder.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.11.0