Deprecate InvVect_* constants in favor of InvType*.
This commit changes the InvVect_* constants, which are not standard Go style, to the InvType*. In order to preserve backwards compatibility, it also adds a legacy.go file which maps the old public constant names to the new ones. Closes #1.
This commit is contained in:
parent
95ecbadb8e
commit
93d86305a2
6 changed files with 51 additions and 37 deletions
12
invvect.go
12
invvect.go
|
@ -23,16 +23,16 @@ type InvType uint32
|
||||||
|
|
||||||
// These constants define the various supported inventory vector types.
|
// These constants define the various supported inventory vector types.
|
||||||
const (
|
const (
|
||||||
InvVect_Error InvType = 0
|
InvTypeError InvType = 0
|
||||||
InvVect_Tx InvType = 1
|
InvTypeTx InvType = 1
|
||||||
InvVect_Block InvType = 2
|
InvTypeBlock InvType = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
// Map of service flags back to their constant names for pretty printing.
|
// Map of service flags back to their constant names for pretty printing.
|
||||||
var ivStrings = map[InvType]string{
|
var ivStrings = map[InvType]string{
|
||||||
InvVect_Error: "ERROR",
|
InvTypeError: "ERROR",
|
||||||
InvVect_Tx: "MSG_TX",
|
InvTypeTx: "MSG_TX",
|
||||||
InvVect_Block: "MSG_BLOCK",
|
InvTypeBlock: "MSG_BLOCK",
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns the InvType in human-readable form.
|
// String returns the InvType in human-readable form.
|
||||||
|
|
|
@ -18,9 +18,9 @@ func TestInvTypeStringer(t *testing.T) {
|
||||||
in btcwire.InvType
|
in btcwire.InvType
|
||||||
want string
|
want string
|
||||||
}{
|
}{
|
||||||
{btcwire.InvVect_Error, "ERROR"},
|
{btcwire.InvTypeError, "ERROR"},
|
||||||
{btcwire.InvVect_Tx, "MSG_TX"},
|
{btcwire.InvTypeTx, "MSG_TX"},
|
||||||
{btcwire.InvVect_Block, "MSG_BLOCK"},
|
{btcwire.InvTypeBlock, "MSG_BLOCK"},
|
||||||
{0xffffffff, "Unknown InvType (4294967295)"},
|
{0xffffffff, "Unknown InvType (4294967295)"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ func TestInvTypeStringer(t *testing.T) {
|
||||||
|
|
||||||
// TestInvVect tests the InvVect API.
|
// TestInvVect tests the InvVect API.
|
||||||
func TestInvVect(t *testing.T) {
|
func TestInvVect(t *testing.T) {
|
||||||
ivType := btcwire.InvVect_Block
|
ivType := btcwire.InvTypeBlock
|
||||||
hash := btcwire.ShaHash{}
|
hash := btcwire.ShaHash{}
|
||||||
|
|
||||||
// Ensure we get the same payload and signature back out.
|
// Ensure we get the same payload and signature back out.
|
||||||
|
@ -66,13 +66,13 @@ func TestInvVectWire(t *testing.T) {
|
||||||
|
|
||||||
// errInvVect is an inventory vector with an error.
|
// errInvVect is an inventory vector with an error.
|
||||||
errInvVect := btcwire.InvVect{
|
errInvVect := btcwire.InvVect{
|
||||||
Type: btcwire.InvVect_Error,
|
Type: btcwire.InvTypeError,
|
||||||
Hash: btcwire.ShaHash{},
|
Hash: btcwire.ShaHash{},
|
||||||
}
|
}
|
||||||
|
|
||||||
// errInvVectEncoded is the wire encoded bytes of errInvVect.
|
// errInvVectEncoded is the wire encoded bytes of errInvVect.
|
||||||
errInvVectEncoded := []byte{
|
errInvVectEncoded := []byte{
|
||||||
0x00, 0x00, 0x00, 0x00, // InvVect_Error
|
0x00, 0x00, 0x00, 0x00, // InvTypeError
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
@ -81,13 +81,13 @@ func TestInvVectWire(t *testing.T) {
|
||||||
|
|
||||||
// txInvVect is an inventory vector representing a transaction.
|
// txInvVect is an inventory vector representing a transaction.
|
||||||
txInvVect := btcwire.InvVect{
|
txInvVect := btcwire.InvVect{
|
||||||
Type: btcwire.InvVect_Tx,
|
Type: btcwire.InvTypeTx,
|
||||||
Hash: *baseHash,
|
Hash: *baseHash,
|
||||||
}
|
}
|
||||||
|
|
||||||
// txInvVectEncoded is the wire encoded bytes of txInvVect.
|
// txInvVectEncoded is the wire encoded bytes of txInvVect.
|
||||||
txInvVectEncoded := []byte{
|
txInvVectEncoded := []byte{
|
||||||
0x01, 0x00, 0x00, 0x00, // InvVect_Tx
|
0x01, 0x00, 0x00, 0x00, // InvTypeTx
|
||||||
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
||||||
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
||||||
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
||||||
|
@ -96,13 +96,13 @@ func TestInvVectWire(t *testing.T) {
|
||||||
|
|
||||||
// blockInvVect is an inventory vector representing a block.
|
// blockInvVect is an inventory vector representing a block.
|
||||||
blockInvVect := btcwire.InvVect{
|
blockInvVect := btcwire.InvVect{
|
||||||
Type: btcwire.InvVect_Block,
|
Type: btcwire.InvTypeBlock,
|
||||||
Hash: *baseHash,
|
Hash: *baseHash,
|
||||||
}
|
}
|
||||||
|
|
||||||
// blockInvVectEncoded is the wire encoded bytes of blockInvVect.
|
// blockInvVectEncoded is the wire encoded bytes of blockInvVect.
|
||||||
blockInvVectEncoded := []byte{
|
blockInvVectEncoded := []byte{
|
||||||
0x02, 0x00, 0x00, 0x00, // InvVect_Block
|
0x02, 0x00, 0x00, 0x00, // InvTypeBlock
|
||||||
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
||||||
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
||||||
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
||||||
|
|
14
legacy.go
Normal file
14
legacy.go
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
package btcwire
|
||||||
|
|
||||||
|
// These constants are deprecated as they do not follow the standard Go style
|
||||||
|
// guidelines and are only provided for backwards compatibility. Use the
|
||||||
|
// InvType* constants instead.
|
||||||
|
const (
|
||||||
|
InvVect_Error InvType = InvTypeError
|
||||||
|
InvVect_Tx InvType = InvTypeTx
|
||||||
|
InvVect_Block InvType = InvTypeBlock
|
||||||
|
)
|
|
@ -37,7 +37,7 @@ func TestGetData(t *testing.T) {
|
||||||
|
|
||||||
// Ensure inventory vectors are added properly.
|
// Ensure inventory vectors are added properly.
|
||||||
hash := btcwire.ShaHash{}
|
hash := btcwire.ShaHash{}
|
||||||
iv := btcwire.NewInvVect(btcwire.InvVect_Block, &hash)
|
iv := btcwire.NewInvVect(btcwire.InvTypeBlock, &hash)
|
||||||
err := msg.AddInvVect(iv)
|
err := msg.AddInvVect(iv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("AddInvVect: %v", err)
|
t.Errorf("AddInvVect: %v", err)
|
||||||
|
@ -77,8 +77,8 @@ func TestGetDataWire(t *testing.T) {
|
||||||
t.Errorf("NewShaHashFromStr: %v", err)
|
t.Errorf("NewShaHashFromStr: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
iv := btcwire.NewInvVect(btcwire.InvVect_Block, blockHash)
|
iv := btcwire.NewInvVect(btcwire.InvTypeBlock, blockHash)
|
||||||
iv2 := btcwire.NewInvVect(btcwire.InvVect_Tx, txHash)
|
iv2 := btcwire.NewInvVect(btcwire.InvTypeTx, txHash)
|
||||||
|
|
||||||
// Empty MsgGetData message.
|
// Empty MsgGetData message.
|
||||||
NoInv := btcwire.NewMsgGetData()
|
NoInv := btcwire.NewMsgGetData()
|
||||||
|
@ -92,12 +92,12 @@ func TestGetDataWire(t *testing.T) {
|
||||||
MultiInv.AddInvVect(iv2)
|
MultiInv.AddInvVect(iv2)
|
||||||
MultiInvEncoded := []byte{
|
MultiInvEncoded := []byte{
|
||||||
0x02, // Varint for number of inv vectors
|
0x02, // Varint for number of inv vectors
|
||||||
0x02, 0x00, 0x00, 0x00, // InvVect_Block
|
0x02, 0x00, 0x00, 0x00, // InvTypeBlock
|
||||||
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
||||||
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
||||||
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
||||||
0x26, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Block 203707 hash
|
0x26, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Block 203707 hash
|
||||||
0x01, 0x00, 0x00, 0x00, // InvVect_Tx
|
0x01, 0x00, 0x00, 0x00, // InvTypeTx
|
||||||
0xf0, 0xfa, 0xcc, 0x7a, 0x48, 0x1b, 0xe7, 0xcf,
|
0xf0, 0xfa, 0xcc, 0x7a, 0x48, 0x1b, 0xe7, 0xcf,
|
||||||
0x42, 0xbd, 0x7f, 0xe5, 0x4f, 0x2c, 0x2a, 0xf8,
|
0x42, 0xbd, 0x7f, 0xe5, 0x4f, 0x2c, 0x2a, 0xf8,
|
||||||
0xef, 0x81, 0x9a, 0xdd, 0x93, 0xee, 0x55, 0x98,
|
0xef, 0x81, 0x9a, 0xdd, 0x93, 0xee, 0x55, 0x98,
|
||||||
|
@ -235,14 +235,14 @@ func TestGetDataWireErrors(t *testing.T) {
|
||||||
t.Errorf("NewShaHashFromStr: %v", err)
|
t.Errorf("NewShaHashFromStr: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
iv := btcwire.NewInvVect(btcwire.InvVect_Block, blockHash)
|
iv := btcwire.NewInvVect(btcwire.InvTypeBlock, blockHash)
|
||||||
|
|
||||||
// Base message used to induce errors.
|
// Base message used to induce errors.
|
||||||
baseGetData := btcwire.NewMsgGetData()
|
baseGetData := btcwire.NewMsgGetData()
|
||||||
baseGetData.AddInvVect(iv)
|
baseGetData.AddInvVect(iv)
|
||||||
baseGetDataEncoded := []byte{
|
baseGetDataEncoded := []byte{
|
||||||
0x02, // Varint for number of inv vectors
|
0x02, // Varint for number of inv vectors
|
||||||
0x02, 0x00, 0x00, 0x00, // InvVect_Block
|
0x02, 0x00, 0x00, 0x00, // InvTypeBlock
|
||||||
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
||||||
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
||||||
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
||||||
|
|
|
@ -37,7 +37,7 @@ func TestInv(t *testing.T) {
|
||||||
|
|
||||||
// Ensure inventory vectors are added properly.
|
// Ensure inventory vectors are added properly.
|
||||||
hash := btcwire.ShaHash{}
|
hash := btcwire.ShaHash{}
|
||||||
iv := btcwire.NewInvVect(btcwire.InvVect_Block, &hash)
|
iv := btcwire.NewInvVect(btcwire.InvTypeBlock, &hash)
|
||||||
err := msg.AddInvVect(iv)
|
err := msg.AddInvVect(iv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("AddInvVect: %v", err)
|
t.Errorf("AddInvVect: %v", err)
|
||||||
|
@ -77,8 +77,8 @@ func TestInvWire(t *testing.T) {
|
||||||
t.Errorf("NewShaHashFromStr: %v", err)
|
t.Errorf("NewShaHashFromStr: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
iv := btcwire.NewInvVect(btcwire.InvVect_Block, blockHash)
|
iv := btcwire.NewInvVect(btcwire.InvTypeBlock, blockHash)
|
||||||
iv2 := btcwire.NewInvVect(btcwire.InvVect_Tx, txHash)
|
iv2 := btcwire.NewInvVect(btcwire.InvTypeTx, txHash)
|
||||||
|
|
||||||
// Empty inv message.
|
// Empty inv message.
|
||||||
NoInv := btcwire.NewMsgInv()
|
NoInv := btcwire.NewMsgInv()
|
||||||
|
@ -92,12 +92,12 @@ func TestInvWire(t *testing.T) {
|
||||||
MultiInv.AddInvVect(iv2)
|
MultiInv.AddInvVect(iv2)
|
||||||
MultiInvEncoded := []byte{
|
MultiInvEncoded := []byte{
|
||||||
0x02, // Varint for number of inv vectors
|
0x02, // Varint for number of inv vectors
|
||||||
0x02, 0x00, 0x00, 0x00, // InvVect_Block
|
0x02, 0x00, 0x00, 0x00, // InvTypeBlock
|
||||||
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
||||||
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
||||||
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
||||||
0x26, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Block 203707 hash
|
0x26, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Block 203707 hash
|
||||||
0x01, 0x00, 0x00, 0x00, // InvVect_Tx
|
0x01, 0x00, 0x00, 0x00, // InvTypeTx
|
||||||
0xf0, 0xfa, 0xcc, 0x7a, 0x48, 0x1b, 0xe7, 0xcf,
|
0xf0, 0xfa, 0xcc, 0x7a, 0x48, 0x1b, 0xe7, 0xcf,
|
||||||
0x42, 0xbd, 0x7f, 0xe5, 0x4f, 0x2c, 0x2a, 0xf8,
|
0x42, 0xbd, 0x7f, 0xe5, 0x4f, 0x2c, 0x2a, 0xf8,
|
||||||
0xef, 0x81, 0x9a, 0xdd, 0x93, 0xee, 0x55, 0x98,
|
0xef, 0x81, 0x9a, 0xdd, 0x93, 0xee, 0x55, 0x98,
|
||||||
|
@ -235,14 +235,14 @@ func TestInvWireErrors(t *testing.T) {
|
||||||
t.Errorf("NewShaHashFromStr: %v", err)
|
t.Errorf("NewShaHashFromStr: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
iv := btcwire.NewInvVect(btcwire.InvVect_Block, blockHash)
|
iv := btcwire.NewInvVect(btcwire.InvTypeBlock, blockHash)
|
||||||
|
|
||||||
// Base inv message used to induce errors.
|
// Base inv message used to induce errors.
|
||||||
baseInv := btcwire.NewMsgInv()
|
baseInv := btcwire.NewMsgInv()
|
||||||
baseInv.AddInvVect(iv)
|
baseInv.AddInvVect(iv)
|
||||||
baseInvEncoded := []byte{
|
baseInvEncoded := []byte{
|
||||||
0x02, // Varint for number of inv vectors
|
0x02, // Varint for number of inv vectors
|
||||||
0x02, 0x00, 0x00, 0x00, // InvVect_Block
|
0x02, 0x00, 0x00, 0x00, // InvTypeBlock
|
||||||
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
||||||
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
||||||
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
||||||
|
|
|
@ -37,7 +37,7 @@ func TestNotFound(t *testing.T) {
|
||||||
|
|
||||||
// Ensure inventory vectors are added properly.
|
// Ensure inventory vectors are added properly.
|
||||||
hash := btcwire.ShaHash{}
|
hash := btcwire.ShaHash{}
|
||||||
iv := btcwire.NewInvVect(btcwire.InvVect_Block, &hash)
|
iv := btcwire.NewInvVect(btcwire.InvTypeBlock, &hash)
|
||||||
err := msg.AddInvVect(iv)
|
err := msg.AddInvVect(iv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("AddInvVect: %v", err)
|
t.Errorf("AddInvVect: %v", err)
|
||||||
|
@ -77,8 +77,8 @@ func TestNotFoundWire(t *testing.T) {
|
||||||
t.Errorf("NewShaHashFromStr: %v", err)
|
t.Errorf("NewShaHashFromStr: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
iv := btcwire.NewInvVect(btcwire.InvVect_Block, blockHash)
|
iv := btcwire.NewInvVect(btcwire.InvTypeBlock, blockHash)
|
||||||
iv2 := btcwire.NewInvVect(btcwire.InvVect_Tx, txHash)
|
iv2 := btcwire.NewInvVect(btcwire.InvTypeTx, txHash)
|
||||||
|
|
||||||
// Empty notfound message.
|
// Empty notfound message.
|
||||||
NoInv := btcwire.NewMsgNotFound()
|
NoInv := btcwire.NewMsgNotFound()
|
||||||
|
@ -92,12 +92,12 @@ func TestNotFoundWire(t *testing.T) {
|
||||||
MultiInv.AddInvVect(iv2)
|
MultiInv.AddInvVect(iv2)
|
||||||
MultiInvEncoded := []byte{
|
MultiInvEncoded := []byte{
|
||||||
0x02, // Varint for number of inv vectors
|
0x02, // Varint for number of inv vectors
|
||||||
0x02, 0x00, 0x00, 0x00, // InvVect_Block
|
0x02, 0x00, 0x00, 0x00, // InvTypeBlock
|
||||||
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
||||||
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
||||||
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
||||||
0x26, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Block 203707 hash
|
0x26, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Block 203707 hash
|
||||||
0x01, 0x00, 0x00, 0x00, // InvVect_Tx
|
0x01, 0x00, 0x00, 0x00, // InvTypeTx
|
||||||
0xf0, 0xfa, 0xcc, 0x7a, 0x48, 0x1b, 0xe7, 0xcf,
|
0xf0, 0xfa, 0xcc, 0x7a, 0x48, 0x1b, 0xe7, 0xcf,
|
||||||
0x42, 0xbd, 0x7f, 0xe5, 0x4f, 0x2c, 0x2a, 0xf8,
|
0x42, 0xbd, 0x7f, 0xe5, 0x4f, 0x2c, 0x2a, 0xf8,
|
||||||
0xef, 0x81, 0x9a, 0xdd, 0x93, 0xee, 0x55, 0x98,
|
0xef, 0x81, 0x9a, 0xdd, 0x93, 0xee, 0x55, 0x98,
|
||||||
|
@ -235,14 +235,14 @@ func TestNotFoundWireErrors(t *testing.T) {
|
||||||
t.Errorf("NewShaHashFromStr: %v", err)
|
t.Errorf("NewShaHashFromStr: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
iv := btcwire.NewInvVect(btcwire.InvVect_Block, blockHash)
|
iv := btcwire.NewInvVect(btcwire.InvTypeBlock, blockHash)
|
||||||
|
|
||||||
// Base message used to induce errors.
|
// Base message used to induce errors.
|
||||||
baseNotFound := btcwire.NewMsgNotFound()
|
baseNotFound := btcwire.NewMsgNotFound()
|
||||||
baseNotFound.AddInvVect(iv)
|
baseNotFound.AddInvVect(iv)
|
||||||
baseNotFoundEncoded := []byte{
|
baseNotFoundEncoded := []byte{
|
||||||
0x02, // Varint for number of inv vectors
|
0x02, // Varint for number of inv vectors
|
||||||
0x02, 0x00, 0x00, 0x00, // InvVect_Block
|
0x02, 0x00, 0x00, 0x00, // InvTypeBlock
|
||||||
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7,
|
||||||
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b,
|
||||||
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b,
|
||||||
|
|
Loading…
Reference in a new issue