func ExampleStore_Balance() {
	s, db, teardown, err := testStore()
	defer teardown()
	if err != nil {
		fmt.Println(err)
		return
	}
	printBalances := func(syncHeight int32) {
		dbtx, err := db.BeginReadTx()
		if err != nil {
			fmt.Println(err)
			return
		}
		defer dbtx.Rollback()
		ns := dbtx.ReadBucket(namespaceKey)
		zeroConfBal, err := s.Balance(ns, 0, syncHeight)
		if err != nil {
			fmt.Println(err)
			return
		}
		oneConfBal, err := s.Balance(ns, 1, syncHeight)
		if err != nil {
			fmt.Println(err)
			return
		}
		sixConfBal, err := s.Balance(ns, 6, syncHeight)
		if err != nil {
			fmt.Println(err)
			return
		}
		fmt.Printf("%v, %v, %v\n", zeroConfBal, oneConfBal, sixConfBal)
	}
	err = walletdb.Update(db, func(tx walletdb.ReadWriteTx) error {
		ns := tx.ReadWriteBucket(namespaceKey)
		err := s.InsertTx(ns, exampleTxRecordA, nil)
		if err != nil {
			return err
		}
		return s.AddCredit(ns, exampleTxRecordA, nil, 0, false)
	})
	if err != nil {
		fmt.Println(err)
		return
	}
	printBalances(100)
	err = walletdb.Update(db, func(tx walletdb.ReadWriteTx) error {
		ns := tx.ReadWriteBucket(namespaceKey)
		return s.InsertTx(ns, exampleTxRecordA, &exampleBlock100)
	})
	if err != nil {
		fmt.Println(err)
		return
	}
	printBalances(100)
	printBalances(105)
}
This example demonstrates reporting the Store balance given an unmined and
mined transaction given 0, 1, and 6 block confirmations.
package wtxmgr
import (
	"fmt"
	"github.com/gcash/bchd/chaincfg"
	"github.com/gcash/bchd/chaincfg/chainhash"
	"github.com/gcash/bchd/wire"
	"github.com/gcash/bchwallet/walletdb"
)
var (
	exampleTxRecordA *TxRecord
	exampleTxRecordB *TxRecord
)
func init() {
	tx := spendOutput(&chainhash.Hash{}, 0, 10e8)
	rec, err := NewTxRecordFromMsgTx(tx, timeNow())
	if err != nil {
		panic(err)
	}
	exampleTxRecordA = rec
	tx = spendOutput(&exampleTxRecordA.Hash, 0, 5e8, 5e8)
	rec, err = NewTxRecordFromMsgTx(tx, timeNow())
	if err != nil {
		panic(err)
	}
	exampleTxRecordB = rec
}
var exampleBlock100 = makeBlockMeta(100)