mirror of
https://github.com/btcsuite/btcd.git
synced 2025-03-12 10:30:49 +01:00
The testing function in export_test.go is changed to just export.go so that callers outside the ffldb package will be able to call the function. The main use for this is so that the prune code can be triggered from the blockchain package. This allows testing code to have less than 1.5GB worth of blocks to trigger the prune.
23 lines
694 B
Go
23 lines
694 B
Go
// Copyright (c) 2015-2016 The btcsuite developers
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package ffldb
|
|
|
|
import (
|
|
"github.com/btcsuite/btcd/database"
|
|
)
|
|
|
|
// TstRunWithMaxBlockFileSize runs the passed function with the maximum allowed
|
|
// file size for the database set to the provided value. The value will be set
|
|
// back to the original value upon completion.
|
|
//
|
|
// Callers should only use this for testing.
|
|
func TstRunWithMaxBlockFileSize(idb database.DB, size uint32, fn func()) {
|
|
ffldb := idb.(*db)
|
|
origSize := ffldb.store.maxBlockFileSize
|
|
|
|
ffldb.store.maxBlockFileSize = size
|
|
fn()
|
|
ffldb.store.maxBlockFileSize = origSize
|
|
}
|