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 ddb741a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions wstakemgr/stake.go
Original file line number Diff line number Diff line change
Expand Up @@ -808,22 +808,22 @@ 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,
ssgenSha,
ssgenTx.Sha(),
voteBits,
sstx.Sha())
if err != nil {
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,21 +998,21 @@ 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,
ssrtxSha,
ssrtxTx.Sha(),
sstx.Sha())
if err != nil {
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 ddb741a

Please sign in to comment.