func (db *DB) updateBlockHeight(blockHeight uint64) {

	var addressDBPath = path.Join(db.filePath, addressDBFileName)

	//Update memory
	db.height = blockHeight
	blockHeightBytes := serializeBlockHeight(blockHeight)

	//Store the blockHeight in disk
	// It will be created if it doesn't exist and close at the end of the function
	fp, err := os.OpenFile(addressDBPath, os.O_WRONLY, 0600)
	if err != nil {
		log.Fatal(err)
	}
	defer fp.Close()

	n, err := fp.Write(blockHeightBytes)
	log.Println("Wrote", n, "bytes to DB file.")
	if err != nil {
		log.Fatalln("Write failed:", err)
	}

	log.Println("DB Block Height updated to " + strconv.FormatUint(blockHeight, 10))
}
//updateBlockHeight updates the block height by updating memory and disk
updateBlockHeight updates the block height by updating memory and disk
// updateBlockHeight updates the block height by updating memory and disk
func (db *DB) updateBlockHeight(blockHeight uint64) {
	var addressDBPath = path.Join(db.filePath, addressDBFileName)
	db.height = blockHeight
	blockHeightBytes := serializeBlockHeight(blockHeight)
	fp, err := os.OpenFile(addressDBPath, os.O_WRONLY, 0600)
	if err != nil {
		log.Fatal(err)
	}
	defer fp.Close()
	n, err := fp.Write(blockHeightBytes)
	log.Println("Wrote", n, "bytes to DB file.")
	if err != nil {
		log.Fatalln("Write failed:", err)
	}
	log.Println("DB Block Height updated to " + strconv.FormatUint(blockHeight, 10))
}
func ( db * DB ) updateBlockHeight ( blockHeight uint64 ) { var addressDBPath = path . Join ( db . filePath , addressDBFileName ) db . height = blockHeight blockHeightBytes := serializeBlockHeight ( blockHeight ) fp , err := os . OpenFile ( addressDBPath , os . O_WRONLY , 0600 ) if err != nil { log . Fatal ( err ) } defer fp . Close ( ) n , err := fp . Write ( blockHeightBytes ) log . Println ( " " , n , " " ) if err != nil { log . Fatalln ( " " , err ) } log . Println ( " " + strconv . FormatUint ( blockHeight , 10 ) ) }
updateBlockHeight updates the block height by updating memory and disk
updateBlockHeight updates the block height by updating memory and disk
//Update memory //Store the blockHeight in disk // It will be created if it doesn't exist and close at the end of the function