forked from cerc-io/ipld-eth-server
Update dependencies
- uses newer version of go-ethereum required for go1.11
This commit is contained in:
+35
@@ -10,6 +10,8 @@ package btcjson
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
)
|
||||
|
||||
// AddNodeSubCmd defines the type used in the addnode JSON-RPC command for the
|
||||
@@ -279,6 +281,37 @@ func NewGetBlockTemplateCmd(request *TemplateRequest) *GetBlockTemplateCmd {
|
||||
}
|
||||
}
|
||||
|
||||
// GetCFilterCmd defines the getcfilter JSON-RPC command.
|
||||
type GetCFilterCmd struct {
|
||||
Hash string
|
||||
FilterType wire.FilterType
|
||||
}
|
||||
|
||||
// NewGetCFilterCmd returns a new instance which can be used to issue a
|
||||
// getcfilter JSON-RPC command.
|
||||
func NewGetCFilterCmd(hash string, filterType wire.FilterType) *GetCFilterCmd {
|
||||
return &GetCFilterCmd{
|
||||
Hash: hash,
|
||||
FilterType: filterType,
|
||||
}
|
||||
}
|
||||
|
||||
// GetCFilterHeaderCmd defines the getcfilterheader JSON-RPC command.
|
||||
type GetCFilterHeaderCmd struct {
|
||||
Hash string
|
||||
FilterType wire.FilterType
|
||||
}
|
||||
|
||||
// NewGetCFilterHeaderCmd returns a new instance which can be used to issue a
|
||||
// getcfilterheader JSON-RPC command.
|
||||
func NewGetCFilterHeaderCmd(hash string,
|
||||
filterType wire.FilterType) *GetCFilterHeaderCmd {
|
||||
return &GetCFilterHeaderCmd{
|
||||
Hash: hash,
|
||||
FilterType: filterType,
|
||||
}
|
||||
}
|
||||
|
||||
// GetChainTipsCmd defines the getchaintips JSON-RPC command.
|
||||
type GetChainTipsCmd struct{}
|
||||
|
||||
@@ -756,6 +789,8 @@ func init() {
|
||||
MustRegisterCmd("getblockhash", (*GetBlockHashCmd)(nil), flags)
|
||||
MustRegisterCmd("getblockheader", (*GetBlockHeaderCmd)(nil), flags)
|
||||
MustRegisterCmd("getblocktemplate", (*GetBlockTemplateCmd)(nil), flags)
|
||||
MustRegisterCmd("getcfilter", (*GetCFilterCmd)(nil), flags)
|
||||
MustRegisterCmd("getcfilterheader", (*GetCFilterHeaderCmd)(nil), flags)
|
||||
MustRegisterCmd("getchaintips", (*GetChainTipsCmd)(nil), flags)
|
||||
MustRegisterCmd("getconnectioncount", (*GetConnectionCountCmd)(nil), flags)
|
||||
MustRegisterCmd("getdifficulty", (*GetDifficultyCmd)(nil), flags)
|
||||
|
||||
+35
-2
@@ -12,6 +12,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcjson"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
)
|
||||
|
||||
// TestChainSvrCmds tests all of the chain server commands marshal and unmarshal
|
||||
@@ -317,6 +318,38 @@ func TestChainSvrCmds(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "getcfilter",
|
||||
newCmd: func() (interface{}, error) {
|
||||
return btcjson.NewCmd("getcfilter", "123",
|
||||
wire.GCSFilterRegular)
|
||||
},
|
||||
staticCmd: func() interface{} {
|
||||
return btcjson.NewGetCFilterCmd("123",
|
||||
wire.GCSFilterRegular)
|
||||
},
|
||||
marshalled: `{"jsonrpc":"1.0","method":"getcfilter","params":["123",0],"id":1}`,
|
||||
unmarshalled: &btcjson.GetCFilterCmd{
|
||||
Hash: "123",
|
||||
FilterType: wire.GCSFilterRegular,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "getcfilterheader",
|
||||
newCmd: func() (interface{}, error) {
|
||||
return btcjson.NewCmd("getcfilterheader", "123",
|
||||
wire.GCSFilterRegular)
|
||||
},
|
||||
staticCmd: func() interface{} {
|
||||
return btcjson.NewGetCFilterHeaderCmd("123",
|
||||
wire.GCSFilterRegular)
|
||||
},
|
||||
marshalled: `{"jsonrpc":"1.0","method":"getcfilterheader","params":["123",0],"id":1}`,
|
||||
unmarshalled: &btcjson.GetCFilterHeaderCmd{
|
||||
Hash: "123",
|
||||
FilterType: wire.GCSFilterRegular,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "getchaintips",
|
||||
newCmd: func() (interface{}, error) {
|
||||
@@ -1158,8 +1191,8 @@ func TestChainSvrCmdErrors(t *testing.T) {
|
||||
for i, test := range tests {
|
||||
err := json.Unmarshal([]byte(test.marshalled), &test.result)
|
||||
if reflect.TypeOf(err) != reflect.TypeOf(test.err) {
|
||||
t.Errorf("Test #%d (%s) wrong error - got %T (%[2]v), "+
|
||||
"want %T", i, test.name, err, test.err)
|
||||
t.Errorf("Test #%d (%s) wrong error - got %T (%v), "+
|
||||
"want %T", i, test.name, err, err, test.err)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -11,7 +11,7 @@ import "encoding/json"
|
||||
// returns a hex-encoded string.
|
||||
type GetBlockHeaderVerboseResult struct {
|
||||
Hash string `json:"hash"`
|
||||
Confirmations uint64 `json:"confirmations"`
|
||||
Confirmations int64 `json:"confirmations"`
|
||||
Height int32 `json:"height"`
|
||||
Version int32 `json:"version"`
|
||||
VersionHex string `json:"versionHex"`
|
||||
@@ -29,7 +29,7 @@ type GetBlockHeaderVerboseResult struct {
|
||||
// hex-encoded string.
|
||||
type GetBlockVerboseResult struct {
|
||||
Hash string `json:"hash"`
|
||||
Confirmations uint64 `json:"confirmations"`
|
||||
Confirmations int64 `json:"confirmations"`
|
||||
StrippedSize int32 `json:"strippedsize"`
|
||||
Size int32 `json:"size"`
|
||||
Weight int32 `json:"weight"`
|
||||
@@ -289,7 +289,6 @@ type GetTxOutResult struct {
|
||||
Confirmations int64 `json:"confirmations"`
|
||||
Value float64 `json:"value"`
|
||||
ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"`
|
||||
Version int32 `json:"version"`
|
||||
Coinbase bool `json:"coinbase"`
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ func TestMethodUsageText(t *testing.T) {
|
||||
continue
|
||||
}
|
||||
|
||||
// Get the usage again to excerise caching.
|
||||
// Get the usage again to exercise caching.
|
||||
usage, err = btcjson.MethodUsageText(test.method)
|
||||
if err != nil {
|
||||
t.Errorf("Test #%d (%s) unexpected error: %v", i,
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ func typesMaybeCompatible(dest reflect.Type, src reflect.Type) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// When both types are numeric, they are potentially compatibile.
|
||||
// When both types are numeric, they are potentially compatible.
|
||||
srcKind := src.Kind()
|
||||
destKind := dest.Kind()
|
||||
if isNumeric(destKind) && isNumeric(srcKind) {
|
||||
|
||||
+6
-6
@@ -387,8 +387,8 @@ func TestNewCmdErrors(t *testing.T) {
|
||||
for i, test := range tests {
|
||||
_, err := btcjson.NewCmd(test.method, test.args...)
|
||||
if reflect.TypeOf(err) != reflect.TypeOf(test.err) {
|
||||
t.Errorf("Test #%d (%s) wrong error - got %T (%[2]v), "+
|
||||
"want %T", i, test.name, err, test.err)
|
||||
t.Errorf("Test #%d (%s) wrong error - got %T (%v), "+
|
||||
"want %T", i, test.name, err, err, test.err)
|
||||
continue
|
||||
}
|
||||
gotErrorCode := err.(btcjson.Error).ErrorCode
|
||||
@@ -435,8 +435,8 @@ func TestMarshalCmdErrors(t *testing.T) {
|
||||
for i, test := range tests {
|
||||
_, err := btcjson.MarshalCmd(test.id, test.cmd)
|
||||
if reflect.TypeOf(err) != reflect.TypeOf(test.err) {
|
||||
t.Errorf("Test #%d (%s) wrong error - got %T (%[2]v), "+
|
||||
"want %T", i, test.name, err, test.err)
|
||||
t.Errorf("Test #%d (%s) wrong error - got %T (%v), "+
|
||||
"want %T", i, test.name, err, err, test.err)
|
||||
continue
|
||||
}
|
||||
gotErrorCode := err.(btcjson.Error).ErrorCode
|
||||
@@ -504,8 +504,8 @@ func TestUnmarshalCmdErrors(t *testing.T) {
|
||||
for i, test := range tests {
|
||||
_, err := btcjson.UnmarshalCmd(&test.request)
|
||||
if reflect.TypeOf(err) != reflect.TypeOf(test.err) {
|
||||
t.Errorf("Test #%d (%s) wrong error - got %T (%[2]v), "+
|
||||
"want %T", i, test.name, err, test.err)
|
||||
t.Errorf("Test #%d (%s) wrong error - got %T (%v), "+
|
||||
"want %T", i, test.name, err, err, test.err)
|
||||
continue
|
||||
}
|
||||
gotErrorCode := err.(btcjson.Error).ErrorCode
|
||||
|
||||
+2
-2
@@ -699,8 +699,8 @@ func TestGenerateHelpErrors(t *testing.T) {
|
||||
_, err := btcjson.GenerateHelp(test.method, nil,
|
||||
test.resultTypes...)
|
||||
if reflect.TypeOf(err) != reflect.TypeOf(test.err) {
|
||||
t.Errorf("Test #%d (%s) wrong error - got %T (%[2]v), "+
|
||||
"want %T", i, test.name, err, test.err)
|
||||
t.Errorf("Test #%d (%s) wrong error - got %T (%v), "+
|
||||
"want %T", i, test.name, err, err, test.err)
|
||||
continue
|
||||
}
|
||||
gotErrorCode := err.(btcjson.Error).ErrorCode
|
||||
|
||||
+1
@@ -71,6 +71,7 @@ const (
|
||||
ErrRPCDifficulty RPCErrorCode = -5
|
||||
ErrRPCOutOfRange RPCErrorCode = -1
|
||||
ErrRPCNoTxInfo RPCErrorCode = -5
|
||||
ErrRPCNoCFIndex RPCErrorCode = -5
|
||||
ErrRPCNoNewestBlockInfo RPCErrorCode = -5
|
||||
ErrRPCInvalidTxVout RPCErrorCode = -5
|
||||
ErrRPCRawTxString RPCErrorCode = -32602
|
||||
|
||||
+1
-1
@@ -247,7 +247,7 @@ func TestMustRegisterCmdPanic(t *testing.T) {
|
||||
func TestRegisteredCmdMethods(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Ensure the registerd methods are returned.
|
||||
// Ensure the registered methods are returned.
|
||||
methods := btcjson.RegisteredCmdMethods()
|
||||
if len(methods) == 0 {
|
||||
t.Fatal("RegisteredCmdMethods: no methods")
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ const (
|
||||
WalletLockStateNtfnMethod = "walletlockstate"
|
||||
|
||||
// NewTxNtfnMethod is the method used to notify that a wallet server has
|
||||
// added a new transaction to the transaciton store.
|
||||
// added a new transaction to the transaction store.
|
||||
NewTxNtfnMethod = "newtx"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user