btcjson: Remove NewOutPointFromWire and wire dep.
This commit removes the NewOutPointFromWire function from the btcjson version 2 package so it can be used without needing the wire package as a dependency. It also updates the test accordingly. This results in the package only depending on core Go packages. Closes #401.
This commit is contained in:
parent
d6105893af
commit
99ac1f5667
2 changed files with 4 additions and 17 deletions
|
@ -7,10 +7,6 @@
|
|||
|
||||
package btcjson
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
)
|
||||
|
||||
// AuthenticateCmd defines the authenticate JSON-RPC command.
|
||||
type AuthenticateCmd struct {
|
||||
Username string
|
||||
|
@ -71,15 +67,6 @@ type OutPoint struct {
|
|||
Index uint32 `json:"index"`
|
||||
}
|
||||
|
||||
// NewOutPointFromWire creates a new OutPoint from the OutPoint structure
|
||||
// of the btcwire package.
|
||||
func NewOutPointFromWire(op *wire.OutPoint) *OutPoint {
|
||||
return &OutPoint{
|
||||
Hash: op.Hash.String(),
|
||||
Index: op.Index,
|
||||
}
|
||||
}
|
||||
|
||||
// NotifySpentCmd defines the notifyspent JSON-RPC command.
|
||||
type NotifySpentCmd struct {
|
||||
OutPoints []OutPoint
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcjson/v2/btcjson"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
)
|
||||
|
||||
// TestChainSvrWsCmds tests all of the chain server websocket-specific commands
|
||||
|
@ -112,9 +111,10 @@ func TestChainSvrWsCmds(t *testing.T) {
|
|||
},
|
||||
staticCmd: func() interface{} {
|
||||
addrs := []string{"1Address"}
|
||||
hash, _ := wire.NewShaHashFromStr("123")
|
||||
op := wire.NewOutPoint(hash, 0)
|
||||
ops := []btcjson.OutPoint{*btcjson.NewOutPointFromWire(op)}
|
||||
ops := []btcjson.OutPoint{{
|
||||
Hash: "0000000000000000000000000000000000000000000000000000000000000123",
|
||||
Index: 0,
|
||||
}}
|
||||
return btcjson.NewRescanCmd("123", addrs, ops, nil)
|
||||
},
|
||||
marshalled: `{"jsonrpc":"1.0","method":"rescan","params":["123",["1Address"],[{"hash":"0000000000000000000000000000000000000000000000000000000000000123","index":0}]],"id":1}`,
|
||||
|
|
Loading…
Reference in a new issue