OSDN Git Service

fix detach vote (#164)
authormuscle_boy <shenao.78@163.com>
Wed, 12 Jun 2019 08:16:23 +0000 (16:16 +0800)
committerPaladz <yzhu101@uottawa.ca>
Wed, 12 Jun 2019 08:16:23 +0000 (16:16 +0800)
protocol/state/vote_result.go

index 129f3a3..e241bcf 100644 (file)
@@ -120,7 +120,8 @@ func (v *VoteResult) DetachBlock(block *types.Block) error {
                return errors.New("block hash is not equals last block hash of vote result")
        }
 
-       for _, tx := range block.Transactions {
+       for i := len(block.Transactions) - 1; i >= 0; i-- {
+               tx := block.Transactions[i]
                for _, input := range tx.Inputs {
                        unVoteInput, ok := input.TypedInput.(*types.UnvoteInput)
                        if !ok {