Example #1
0
// The block parser only logs stores blocks as they come in
func blockParser(now time.Time, block *btcwire.MsgBlock) {
	_hash, _ := block.BlockSha()
	hash := _hash.String()
	log.Println(hash)
	prevhash := block.Header.PrevBlock.String()
	_, err := conn.Exec("INSERT INTO blocks VALUES ($1, $2)", hash, prevhash)
	if err != nil {
		log.Fatal(err)
	}
}