Skip to content

Commit

Permalink
Fix a bug that caused votes and revocations not being stored
Browse files Browse the repository at this point in the history
In the case of redundant wallets, votes and revocations that were
rejected from the daemon as duplicates were not stored at all in
the stake database. This would cause corrupted values for votes
and revocations when calling getstakeinfo. This was corrected by
storing the votes and revocations first, before shipping to the
daemon.
  • Loading branch information
cjepson committed Feb 25, 2016
1 parent d3ebcbb commit 9c1e89f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions wstakemgr/stake.go
Expand Up @@ -808,12 +808,6 @@ func (s *StakeStore) generateVote(blockHash *chainhash.Hash, height int64,
return nil, err
}

// Send the transaction.
ssgenSha, err := s.chainSvr.SendRawTransaction(msgTx, false)
if err != nil {
return nil, err
}

// Store the information about the SSGen.
err = s.insertSSGen(blockHash,
height,
Expand All @@ -824,6 +818,12 @@ func (s *StakeStore) generateVote(blockHash *chainhash.Hash, height int64,
return nil, err
}

// Send the transaction.
ssgenSha, err := s.chainSvr.SendRawTransaction(msgTx, false)
if err != nil {
return nil, err
}

log.Debugf("Generated SSGen %v , voting on block %v at height %v. "+
"The ticket used to generate the SSGen was %v.",
ssgenSha, blockHash, height, sstxHash)
Expand Down Expand Up @@ -998,12 +998,6 @@ func (s *StakeStore) generateRevocation(blockHash *chainhash.Hash, height int64,
return nil, err
}

// Send the transaction.
ssrtxSha, err := s.chainSvr.SendRawTransaction(msgTx, false)
if err != nil {
return nil, err
}

// Store the information about the SSRtx.
err = s.insertSSRtx(blockHash,
height,
Expand All @@ -1013,6 +1007,12 @@ func (s *StakeStore) generateRevocation(blockHash *chainhash.Hash, height int64,
return nil, err
}

// Send the transaction.
ssrtxSha, err := s.chainSvr.SendRawTransaction(msgTx, false)
if err != nil {
return nil, err
}

log.Debugf("Generated SSRtx %v. "+
"The ticket used to generate the SSRtx was %v.",
ssrtxSha, sstx.Sha())
Expand Down

0 comments on commit 9c1e89f

Please sign in to comment.