43095c66bc
This commit unfortunately changes the public API of Block which I ordinarily don't like to do, but in this case, I felt it was necessary. The blocks used throughout the database and elsewhere should be indepedent of the protocol version which is used to encode the block to wire format. Each block has its own Version field which should be the deciding factor for the serialization and deserialization of blocks. In practice, they are currently the same encoding, but that may not always be the case, and it's important the blocks are stable depending on their own version regardless of the protocol version. This makes use of the new Serialize and Deserialize functions on MsgBlock which are intended for long-term storage as opposed to wire encoding.
19 lines
703 B
Go
19 lines
703 B
Go
// Copyright (c) 2013 Conformal Systems LLC.
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
/*
|
|
This test file is part of the btcutil package rather than than the
|
|
btcutil_test package so it can bridge access to the internals to properly test
|
|
cases which are either not possible or can't reliably be tested via the public
|
|
interface. The functions are only exported while the tests are being run.
|
|
*/
|
|
|
|
package btcutil
|
|
|
|
// SetBlockBytes sets the internal serialized block byte buffer to the passed
|
|
// buffer. It is used to inject errors and is only available to the test
|
|
// package.
|
|
func (b *Block) SetBlockBytes(buf []byte) {
|
|
b.serializedBlock = buf
|
|
}
|