github.com/johnathanhowell/sia@v0.5.1-beta.0.20160524050156-83dcc3d37c94/modules/consensus/consistency_helpers_test.go (about)

     1  package consensus
     2  
     3  import (
     4  	"github.com/NebulousLabs/Sia/crypto"
     5  
     6  	"github.com/NebulousLabs/bolt"
     7  )
     8  
     9  // dbConsensusChecksum is a convenience function to call consensusChecksum
    10  // without a bolt.Tx.
    11  func (cs *ConsensusSet) dbConsensusChecksum() (checksum crypto.Hash) {
    12  	err := cs.db.Update(func(tx *bolt.Tx) error {
    13  		checksum = consensusChecksum(tx)
    14  		return nil
    15  	})
    16  	if err != nil {
    17  		panic(err)
    18  	}
    19  	return checksum
    20  }