mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-10-14 00:59:33 +00:00
[DEV-35] Updated btcjson package to work with DAG
* [DEV-35] Updated btcjson package to work with DAG * [DEV-35] Rename all chainsvr* packages to dagsvr*
This commit is contained in:
parent
7ed7685373
commit
dbd1aec9b8
@ -4,7 +4,7 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// NOTE: This file is intended to house the RPC commands that are supported by
|
// NOTE: This file is intended to house the RPC commands that are supported by
|
||||||
// a chain server with btcd extensions.
|
// a dag server with btcd extensions.
|
||||||
|
|
||||||
package btcjson
|
package btcjson
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// NOTE: This file is intended to house the RPC commands that are supported by
|
// NOTE: This file is intended to house the RPC commands that are supported by
|
||||||
// a chain server.
|
// a dag server.
|
||||||
|
|
||||||
package btcjson
|
package btcjson
|
||||||
|
|
||||||
@ -147,13 +147,13 @@ func NewGetBlockCmd(hash string, verbose, verboseTx *bool) *GetBlockCmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBlockChainInfoCmd defines the getblockchaininfo JSON-RPC command.
|
// GetBlockDAGInfoCmd defines the getblockdaginfo JSON-RPC command.
|
||||||
type GetBlockChainInfoCmd struct{}
|
type GetBlockDAGInfoCmd struct{}
|
||||||
|
|
||||||
// NewGetBlockChainInfoCmd returns a new instance which can be used to issue a
|
// NewGetBlockDAGInfoCmd returns a new instance which can be used to issue a
|
||||||
// getblockchaininfo JSON-RPC command.
|
// getblockdaginfo JSON-RPC command.
|
||||||
func NewGetBlockChainInfoCmd() *GetBlockChainInfoCmd {
|
func NewGetBlockDAGInfoCmd() *GetBlockDAGInfoCmd {
|
||||||
return &GetBlockChainInfoCmd{}
|
return &GetBlockDAGInfoCmd{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBlockCountCmd defines the getblockcount JSON-RPC command.
|
// GetBlockCountCmd defines the getblockcount JSON-RPC command.
|
||||||
@ -312,13 +312,13 @@ func NewGetCFilterHeaderCmd(hash string,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetChainTipsCmd defines the getchaintips JSON-RPC command.
|
// GetDAGTipsCmd defines the getdagtips JSON-RPC command.
|
||||||
type GetChainTipsCmd struct{}
|
type GetDAGTipsCmd struct{}
|
||||||
|
|
||||||
// NewGetChainTipsCmd returns a new instance which can be used to issue a
|
// NewGetDAGTipsCmd returns a new instance which can be used to issue a
|
||||||
// getchaintips JSON-RPC command.
|
// getdagtips JSON-RPC command.
|
||||||
func NewGetChainTipsCmd() *GetChainTipsCmd {
|
func NewGetDAGTipsCmd() *GetDAGTipsCmd {
|
||||||
return &GetChainTipsCmd{}
|
return &GetDAGTipsCmd{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetConnectionCountCmd defines the getconnectioncount JSON-RPC command.
|
// GetConnectionCountCmd defines the getconnectioncount JSON-RPC command.
|
||||||
@ -725,19 +725,19 @@ func NewValidateAddressCmd(address string) *ValidateAddressCmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyChainCmd defines the verifychain JSON-RPC command.
|
// VerifyDAGCmd defines the verifydag JSON-RPC command.
|
||||||
type VerifyChainCmd struct {
|
type VerifyDAGCmd struct {
|
||||||
CheckLevel *int32 `jsonrpcdefault:"3"`
|
CheckLevel *int32 `jsonrpcdefault:"3"`
|
||||||
CheckDepth *int32 `jsonrpcdefault:"288"` // 0 = all
|
CheckDepth *int32 `jsonrpcdefault:"288"` // 0 = all
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVerifyChainCmd returns a new instance which can be used to issue a
|
// NewVerifyDAGCmd returns a new instance which can be used to issue a
|
||||||
// verifychain JSON-RPC command.
|
// verifydag JSON-RPC command.
|
||||||
//
|
//
|
||||||
// The parameters which are pointers indicate they are optional. Passing nil
|
// The parameters which are pointers indicate they are optional. Passing nil
|
||||||
// for optional parameters will use the default value.
|
// for optional parameters will use the default value.
|
||||||
func NewVerifyChainCmd(checkLevel, checkDepth *int32) *VerifyChainCmd {
|
func NewVerifyDAGCmd(checkLevel, checkDepth *int32) *VerifyDAGCmd {
|
||||||
return &VerifyChainCmd{
|
return &VerifyDAGCmd{
|
||||||
CheckLevel: checkLevel,
|
CheckLevel: checkLevel,
|
||||||
CheckDepth: checkDepth,
|
CheckDepth: checkDepth,
|
||||||
}
|
}
|
||||||
@ -784,14 +784,14 @@ func init() {
|
|||||||
MustRegisterCmd("getaddednodeinfo", (*GetAddedNodeInfoCmd)(nil), flags)
|
MustRegisterCmd("getaddednodeinfo", (*GetAddedNodeInfoCmd)(nil), flags)
|
||||||
MustRegisterCmd("getbestblockhash", (*GetBestBlockHashCmd)(nil), flags)
|
MustRegisterCmd("getbestblockhash", (*GetBestBlockHashCmd)(nil), flags)
|
||||||
MustRegisterCmd("getblock", (*GetBlockCmd)(nil), flags)
|
MustRegisterCmd("getblock", (*GetBlockCmd)(nil), flags)
|
||||||
MustRegisterCmd("getblockchaininfo", (*GetBlockChainInfoCmd)(nil), flags)
|
MustRegisterCmd("getblockdaginfo", (*GetBlockDAGInfoCmd)(nil), flags)
|
||||||
MustRegisterCmd("getblockcount", (*GetBlockCountCmd)(nil), flags)
|
MustRegisterCmd("getblockcount", (*GetBlockCountCmd)(nil), flags)
|
||||||
MustRegisterCmd("getblockhash", (*GetBlockHashCmd)(nil), flags)
|
MustRegisterCmd("getblockhash", (*GetBlockHashCmd)(nil), flags)
|
||||||
MustRegisterCmd("getblockheader", (*GetBlockHeaderCmd)(nil), flags)
|
MustRegisterCmd("getblockheader", (*GetBlockHeaderCmd)(nil), flags)
|
||||||
MustRegisterCmd("getblocktemplate", (*GetBlockTemplateCmd)(nil), flags)
|
MustRegisterCmd("getblocktemplate", (*GetBlockTemplateCmd)(nil), flags)
|
||||||
MustRegisterCmd("getcfilter", (*GetCFilterCmd)(nil), flags)
|
MustRegisterCmd("getcfilter", (*GetCFilterCmd)(nil), flags)
|
||||||
MustRegisterCmd("getcfilterheader", (*GetCFilterHeaderCmd)(nil), flags)
|
MustRegisterCmd("getcfilterheader", (*GetCFilterHeaderCmd)(nil), flags)
|
||||||
MustRegisterCmd("getchaintips", (*GetChainTipsCmd)(nil), flags)
|
MustRegisterCmd("getdagtips", (*GetDAGTipsCmd)(nil), flags)
|
||||||
MustRegisterCmd("getconnectioncount", (*GetConnectionCountCmd)(nil), flags)
|
MustRegisterCmd("getconnectioncount", (*GetConnectionCountCmd)(nil), flags)
|
||||||
MustRegisterCmd("getdifficulty", (*GetDifficultyCmd)(nil), flags)
|
MustRegisterCmd("getdifficulty", (*GetDifficultyCmd)(nil), flags)
|
||||||
MustRegisterCmd("getgenerate", (*GetGenerateCmd)(nil), flags)
|
MustRegisterCmd("getgenerate", (*GetGenerateCmd)(nil), flags)
|
||||||
@ -822,7 +822,7 @@ func init() {
|
|||||||
MustRegisterCmd("submitblock", (*SubmitBlockCmd)(nil), flags)
|
MustRegisterCmd("submitblock", (*SubmitBlockCmd)(nil), flags)
|
||||||
MustRegisterCmd("uptime", (*UptimeCmd)(nil), flags)
|
MustRegisterCmd("uptime", (*UptimeCmd)(nil), flags)
|
||||||
MustRegisterCmd("validateaddress", (*ValidateAddressCmd)(nil), flags)
|
MustRegisterCmd("validateaddress", (*ValidateAddressCmd)(nil), flags)
|
||||||
MustRegisterCmd("verifychain", (*VerifyChainCmd)(nil), flags)
|
MustRegisterCmd("verifydag", (*VerifyDAGCmd)(nil), flags)
|
||||||
MustRegisterCmd("verifymessage", (*VerifyMessageCmd)(nil), flags)
|
MustRegisterCmd("verifymessage", (*VerifyMessageCmd)(nil), flags)
|
||||||
MustRegisterCmd("verifytxoutproof", (*VerifyTxOutProofCmd)(nil), flags)
|
MustRegisterCmd("verifytxoutproof", (*VerifyTxOutProofCmd)(nil), flags)
|
||||||
}
|
}
|
@ -15,11 +15,11 @@ import (
|
|||||||
"github.com/daglabs/btcd/wire"
|
"github.com/daglabs/btcd/wire"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestChainSvrCmds tests all of the chain server commands marshal and unmarshal
|
// TestDAGSvrCmds tests all of the dag server commands marshal and unmarshal
|
||||||
// into valid results include handling of optional fields being omitted in the
|
// into valid results include handling of optional fields being omitted in the
|
||||||
// marshalled command, while optional fields with defaults have the default
|
// marshalled command, while optional fields with defaults have the default
|
||||||
// assigned on unmarshalled commands.
|
// assigned on unmarshalled commands.
|
||||||
func TestChainSvrCmds(t *testing.T) {
|
func TestDAGSvrCmds(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
testID := int(1)
|
testID := int(1)
|
||||||
@ -189,15 +189,15 @@ func TestChainSvrCmds(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "getblockchaininfo",
|
name: "getblockdaginfo",
|
||||||
newCmd: func() (interface{}, error) {
|
newCmd: func() (interface{}, error) {
|
||||||
return btcjson.NewCmd("getblockchaininfo")
|
return btcjson.NewCmd("getblockdaginfo")
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewGetBlockChainInfoCmd()
|
return btcjson.NewGetBlockDAGInfoCmd()
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getblockchaininfo","params":[],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getblockdaginfo","params":[],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetBlockChainInfoCmd{},
|
unmarshalled: &btcjson.GetBlockDAGInfoCmd{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "getblockcount",
|
name: "getblockcount",
|
||||||
@ -351,15 +351,15 @@ func TestChainSvrCmds(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "getchaintips",
|
name: "getdagtips",
|
||||||
newCmd: func() (interface{}, error) {
|
newCmd: func() (interface{}, error) {
|
||||||
return btcjson.NewCmd("getchaintips")
|
return btcjson.NewCmd("getdagtips")
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewGetChainTipsCmd()
|
return btcjson.NewGetDAGTipsCmd()
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getchaintips","params":[],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getdagtips","params":[],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetChainTipsCmd{},
|
unmarshalled: &btcjson.GetDAGTipsCmd{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "getconnectioncount",
|
name: "getconnectioncount",
|
||||||
@ -1017,43 +1017,43 @@ func TestChainSvrCmds(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "verifychain",
|
name: "verifydag",
|
||||||
newCmd: func() (interface{}, error) {
|
newCmd: func() (interface{}, error) {
|
||||||
return btcjson.NewCmd("verifychain")
|
return btcjson.NewCmd("verifydag")
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewVerifyChainCmd(nil, nil)
|
return btcjson.NewVerifyDAGCmd(nil, nil)
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"verifychain","params":[],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"verifydag","params":[],"id":1}`,
|
||||||
unmarshalled: &btcjson.VerifyChainCmd{
|
unmarshalled: &btcjson.VerifyDAGCmd{
|
||||||
CheckLevel: btcjson.Int32(3),
|
CheckLevel: btcjson.Int32(3),
|
||||||
CheckDepth: btcjson.Int32(288),
|
CheckDepth: btcjson.Int32(288),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "verifychain optional1",
|
name: "verifydag optional1",
|
||||||
newCmd: func() (interface{}, error) {
|
newCmd: func() (interface{}, error) {
|
||||||
return btcjson.NewCmd("verifychain", 2)
|
return btcjson.NewCmd("verifydag", 2)
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewVerifyChainCmd(btcjson.Int32(2), nil)
|
return btcjson.NewVerifyDAGCmd(btcjson.Int32(2), nil)
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"verifychain","params":[2],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"verifydag","params":[2],"id":1}`,
|
||||||
unmarshalled: &btcjson.VerifyChainCmd{
|
unmarshalled: &btcjson.VerifyDAGCmd{
|
||||||
CheckLevel: btcjson.Int32(2),
|
CheckLevel: btcjson.Int32(2),
|
||||||
CheckDepth: btcjson.Int32(288),
|
CheckDepth: btcjson.Int32(288),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "verifychain optional2",
|
name: "verifydag optional2",
|
||||||
newCmd: func() (interface{}, error) {
|
newCmd: func() (interface{}, error) {
|
||||||
return btcjson.NewCmd("verifychain", 2, 500)
|
return btcjson.NewCmd("verifydag", 2, 500)
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewVerifyChainCmd(btcjson.Int32(2), btcjson.Int32(500))
|
return btcjson.NewVerifyDAGCmd(btcjson.Int32(2), btcjson.Int32(500))
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"verifychain","params":[2,500],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"verifydag","params":[2,500],"id":1}`,
|
||||||
unmarshalled: &btcjson.VerifyChainCmd{
|
unmarshalled: &btcjson.VerifyDAGCmd{
|
||||||
CheckLevel: btcjson.Int32(2),
|
CheckLevel: btcjson.Int32(2),
|
||||||
CheckDepth: btcjson.Int32(500),
|
CheckDepth: btcjson.Int32(500),
|
||||||
},
|
},
|
||||||
@ -1156,9 +1156,9 @@ func TestChainSvrCmds(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestChainSvrCmdErrors ensures any errors that occur in the command during
|
// TestDAGSvrCmdErrors ensures any errors that occur in the command during
|
||||||
// custom mashal and unmarshal are as expected.
|
// custom mashal and unmarshal are as expected.
|
||||||
func TestChainSvrCmdErrors(t *testing.T) {
|
func TestDAGSvrCmdErrors(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
@ -95,19 +95,19 @@ type Bip9SoftForkDescription struct {
|
|||||||
Since int32 `json:"since"`
|
Since int32 `json:"since"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBlockChainInfoResult models the data returned from the getblockchaininfo
|
// GetBlockDAGInfoResult models the data returned from the getblockdaginfo
|
||||||
// command.
|
// command.
|
||||||
type GetBlockChainInfoResult struct {
|
type GetBlockDAGInfoResult struct {
|
||||||
Chain string `json:"chain"`
|
DAG string `json:"dag"`
|
||||||
Blocks int32 `json:"blocks"`
|
Blocks int32 `json:"blocks"`
|
||||||
Headers int32 `json:"headers"`
|
Headers int32 `json:"headers"`
|
||||||
BestBlockHash string `json:"bestblockhash"`
|
TipHashes []string `json:"tiphashes"`
|
||||||
Difficulty float64 `json:"difficulty"`
|
Difficulty float64 `json:"difficulty"`
|
||||||
MedianTime int64 `json:"mediantime"`
|
MedianTime int64 `json:"mediantime"`
|
||||||
VerificationProgress float64 `json:"verificationprogress,omitempty"`
|
VerificationProgress float64 `json:"verificationprogress,omitempty"`
|
||||||
Pruned bool `json:"pruned"`
|
Pruned bool `json:"pruned"`
|
||||||
PruneHeight int32 `json:"pruneheight,omitempty"`
|
PruneHeight int32 `json:"pruneheight,omitempty"`
|
||||||
ChainWork string `json:"chainwork,omitempty"`
|
DAGWork string `json:"dagwork,omitempty"`
|
||||||
SoftForks []*SoftForkDescription `json:"softforks"`
|
SoftForks []*SoftForkDescription `json:"softforks"`
|
||||||
Bip9SoftForks map[string]*Bip9SoftForkDescription `json:"bip9_softforks"`
|
Bip9SoftForks map[string]*Bip9SoftForkDescription `json:"bip9_softforks"`
|
||||||
}
|
}
|
||||||
@ -423,8 +423,8 @@ type GetWorkResult struct {
|
|||||||
Target string `json:"target"`
|
Target string `json:"target"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfoChainResult models the data returned by the chain server getinfo command.
|
// InfoDAGResult models the data returned by the dag server getinfo command.
|
||||||
type InfoChainResult struct {
|
type InfoDAGResult struct {
|
||||||
Version int32 `json:"version"`
|
Version int32 `json:"version"`
|
||||||
ProtocolVersion int32 `json:"protocolversion"`
|
ProtocolVersion int32 `json:"protocolversion"`
|
||||||
Blocks int32 `json:"blocks"`
|
Blocks int32 `json:"blocks"`
|
||||||
@ -479,9 +479,9 @@ type TxRawDecodeResult struct {
|
|||||||
Vout []Vout `json:"vout"`
|
Vout []Vout `json:"vout"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateAddressChainResult models the data returned by the chain server
|
// ValidateAddressResult models the data returned by the dag server
|
||||||
// validateaddress command.
|
// validateaddress command.
|
||||||
type ValidateAddressChainResult struct {
|
type ValidateAddressResult struct {
|
||||||
IsValid bool `json:"isvalid"`
|
IsValid bool `json:"isvalid"`
|
||||||
Address string `json:"address,omitempty"`
|
Address string `json:"address,omitempty"`
|
||||||
}
|
}
|
@ -11,10 +11,10 @@ import (
|
|||||||
"github.com/daglabs/btcd/btcjson"
|
"github.com/daglabs/btcd/btcjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestChainSvrCustomResults ensures any results that have custom marshalling
|
// TestDAGSvrCustomResults ensures any results that have custom marshalling
|
||||||
// work as inteded.
|
// work as inteded.
|
||||||
// and unmarshal code of results are as expected.
|
// and unmarshal code of results are as expected.
|
||||||
func TestChainSvrCustomResults(t *testing.T) {
|
func TestDAGSvrCustomResults(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
@ -4,7 +4,7 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// NOTE: This file is intended to house the RPC commands that are supported by
|
// NOTE: This file is intended to house the RPC commands that are supported by
|
||||||
// a chain server, but are only available via websockets.
|
// a dag server, but are only available via websockets.
|
||||||
|
|
||||||
package btcjson
|
package btcjson
|
||||||
|
|
@ -15,11 +15,11 @@ import (
|
|||||||
"github.com/daglabs/btcd/btcjson"
|
"github.com/daglabs/btcd/btcjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestChainSvrWsCmds tests all of the chain server websocket-specific commands
|
// TestDAGSvrWsCmds tests all of the dag server websocket-specific commands
|
||||||
// marshal and unmarshal into valid results include handling of optional fields
|
// marshal and unmarshal into valid results include handling of optional fields
|
||||||
// being omitted in the marshalled command, while optional fields with defaults
|
// being omitted in the marshalled command, while optional fields with defaults
|
||||||
// have the default assigned on unmarshalled commands.
|
// have the default assigned on unmarshalled commands.
|
||||||
func TestChainSvrWsCmds(t *testing.T) {
|
func TestDAGSvrWsCmds(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
testID := int(1)
|
testID := int(1)
|
@ -4,35 +4,35 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// NOTE: This file is intended to house the RPC websocket notifications that are
|
// NOTE: This file is intended to house the RPC websocket notifications that are
|
||||||
// supported by a chain server.
|
// supported by a dag server.
|
||||||
|
|
||||||
package btcjson
|
package btcjson
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// BlockConnectedNtfnMethod is the legacy, deprecated method used for
|
// BlockConnectedNtfnMethod is the legacy, deprecated method used for
|
||||||
// notifications from the chain server that a block has been connected.
|
// notifications from the dag server that a block has been connected.
|
||||||
//
|
//
|
||||||
// NOTE: Deprecated. Use FilteredBlockConnectedNtfnMethod instead.
|
// NOTE: Deprecated. Use FilteredBlockConnectedNtfnMethod instead.
|
||||||
BlockConnectedNtfnMethod = "blockconnected"
|
BlockConnectedNtfnMethod = "blockconnected"
|
||||||
|
|
||||||
// BlockDisconnectedNtfnMethod is the legacy, deprecated method used for
|
// BlockDisconnectedNtfnMethod is the legacy, deprecated method used for
|
||||||
// notifications from the chain server that a block has been
|
// notifications from the dag server that a block has been
|
||||||
// disconnected.
|
// disconnected.
|
||||||
//
|
//
|
||||||
// NOTE: Deprecated. Use FilteredBlockDisconnectedNtfnMethod instead.
|
// NOTE: Deprecated. Use FilteredBlockDisconnectedNtfnMethod instead.
|
||||||
BlockDisconnectedNtfnMethod = "blockdisconnected"
|
BlockDisconnectedNtfnMethod = "blockdisconnected"
|
||||||
|
|
||||||
// FilteredBlockConnectedNtfnMethod is the new method used for
|
// FilteredBlockConnectedNtfnMethod is the new method used for
|
||||||
// notifications from the chain server that a block has been connected.
|
// notifications from the dag server that a block has been connected.
|
||||||
FilteredBlockConnectedNtfnMethod = "filteredblockconnected"
|
FilteredBlockConnectedNtfnMethod = "filteredblockconnected"
|
||||||
|
|
||||||
// FilteredBlockDisconnectedNtfnMethod is the new method used for
|
// FilteredBlockDisconnectedNtfnMethod is the new method used for
|
||||||
// notifications from the chain server that a block has been
|
// notifications from the dag server that a block has been
|
||||||
// disconnected.
|
// disconnected.
|
||||||
FilteredBlockDisconnectedNtfnMethod = "filteredblockdisconnected"
|
FilteredBlockDisconnectedNtfnMethod = "filteredblockdisconnected"
|
||||||
|
|
||||||
// RecvTxNtfnMethod is the legacy, deprecated method used for
|
// RecvTxNtfnMethod is the legacy, deprecated method used for
|
||||||
// notifications from the chain server that a transaction which pays to
|
// notifications from the dag server that a transaction which pays to
|
||||||
// a registered address has been processed.
|
// a registered address has been processed.
|
||||||
//
|
//
|
||||||
// NOTE: Deprecated. Use RelevantTxAcceptedNtfnMethod and
|
// NOTE: Deprecated. Use RelevantTxAcceptedNtfnMethod and
|
||||||
@ -40,7 +40,7 @@ const (
|
|||||||
RecvTxNtfnMethod = "recvtx"
|
RecvTxNtfnMethod = "recvtx"
|
||||||
|
|
||||||
// RedeemingTxNtfnMethod is the legacy, deprecated method used for
|
// RedeemingTxNtfnMethod is the legacy, deprecated method used for
|
||||||
// notifications from the chain server that a transaction which spends a
|
// notifications from the dag server that a transaction which spends a
|
||||||
// registered outpoint has been processed.
|
// registered outpoint has been processed.
|
||||||
//
|
//
|
||||||
// NOTE: Deprecated. Use RelevantTxAcceptedNtfnMethod and
|
// NOTE: Deprecated. Use RelevantTxAcceptedNtfnMethod and
|
||||||
@ -48,31 +48,31 @@ const (
|
|||||||
RedeemingTxNtfnMethod = "redeemingtx"
|
RedeemingTxNtfnMethod = "redeemingtx"
|
||||||
|
|
||||||
// RescanFinishedNtfnMethod is the legacy, deprecated method used for
|
// RescanFinishedNtfnMethod is the legacy, deprecated method used for
|
||||||
// notifications from the chain server that a legacy, deprecated rescan
|
// notifications from the dag server that a legacy, deprecated rescan
|
||||||
// operation has finished.
|
// operation has finished.
|
||||||
//
|
//
|
||||||
// NOTE: Deprecated. Not used with rescanblocks command.
|
// NOTE: Deprecated. Not used with rescanblocks command.
|
||||||
RescanFinishedNtfnMethod = "rescanfinished"
|
RescanFinishedNtfnMethod = "rescanfinished"
|
||||||
|
|
||||||
// RescanProgressNtfnMethod is the legacy, deprecated method used for
|
// RescanProgressNtfnMethod is the legacy, deprecated method used for
|
||||||
// notifications from the chain server that a legacy, deprecated rescan
|
// notifications from the dag server that a legacy, deprecated rescan
|
||||||
// operation this is underway has made progress.
|
// operation this is underway has made progress.
|
||||||
//
|
//
|
||||||
// NOTE: Deprecated. Not used with rescanblocks command.
|
// NOTE: Deprecated. Not used with rescanblocks command.
|
||||||
RescanProgressNtfnMethod = "rescanprogress"
|
RescanProgressNtfnMethod = "rescanprogress"
|
||||||
|
|
||||||
// TxAcceptedNtfnMethod is the method used for notifications from the
|
// TxAcceptedNtfnMethod is the method used for notifications from the
|
||||||
// chain server that a transaction has been accepted into the mempool.
|
// dag server that a transaction has been accepted into the mempool.
|
||||||
TxAcceptedNtfnMethod = "txaccepted"
|
TxAcceptedNtfnMethod = "txaccepted"
|
||||||
|
|
||||||
// TxAcceptedVerboseNtfnMethod is the method used for notifications from
|
// TxAcceptedVerboseNtfnMethod is the method used for notifications from
|
||||||
// the chain server that a transaction has been accepted into the
|
// the dag server that a transaction has been accepted into the
|
||||||
// mempool. This differs from TxAcceptedNtfnMethod in that it provides
|
// mempool. This differs from TxAcceptedNtfnMethod in that it provides
|
||||||
// more details in the notification.
|
// more details in the notification.
|
||||||
TxAcceptedVerboseNtfnMethod = "txacceptedverbose"
|
TxAcceptedVerboseNtfnMethod = "txacceptedverbose"
|
||||||
|
|
||||||
// RelevantTxAcceptedNtfnMethod is the new method used for notifications
|
// RelevantTxAcceptedNtfnMethod is the new method used for notifications
|
||||||
// from the chain server that inform a client that a transaction that
|
// from the dag server that inform a client that a transaction that
|
||||||
// matches the loaded filter was accepted by the mempool.
|
// matches the loaded filter was accepted by the mempool.
|
||||||
RelevantTxAcceptedNtfnMethod = "relevanttxaccepted"
|
RelevantTxAcceptedNtfnMethod = "relevanttxaccepted"
|
||||||
)
|
)
|
@ -15,11 +15,11 @@ import (
|
|||||||
"github.com/daglabs/btcd/btcjson"
|
"github.com/daglabs/btcd/btcjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestChainSvrWsNtfns tests all of the chain server websocket-specific
|
// TestDAGSvrWsNtfns tests all of the dag server websocket-specific
|
||||||
// notifications marshal and unmarshal into valid results include handling of
|
// notifications marshal and unmarshal into valid results include handling of
|
||||||
// optional fields being omitted in the marshalled command, while optional
|
// optional fields being omitted in the marshalled command, while optional
|
||||||
// fields with defaults have the default assigned on unmarshalled commands.
|
// fields with defaults have the default assigned on unmarshalled commands.
|
||||||
func TestChainSvrWsNtfns(t *testing.T) {
|
func TestDAGSvrWsNtfns(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
@ -12,9 +12,9 @@ import (
|
|||||||
"github.com/daglabs/btcd/btcjson"
|
"github.com/daglabs/btcd/btcjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestChainSvrWsResults ensures any results that have custom marshalling
|
// TestDAGSvrWsResults ensures any results that have custom marshalling
|
||||||
// work as inteded.
|
// work as inteded.
|
||||||
func TestChainSvrWsResults(t *testing.T) {
|
func TestDAGSvrWsResults(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
@ -107,7 +107,7 @@ function.
|
|||||||
Command Inspection
|
Command Inspection
|
||||||
|
|
||||||
All registered commands are registered with flags that identify information such
|
All registered commands are registered with flags that identify information such
|
||||||
as whether the command applies to a chain server, wallet server, or is a
|
as whether the command applies to a dag server, wallet server, or is a
|
||||||
notification along with the method name to use. These flags can be obtained
|
notification along with the method name to use. These flags can be obtained
|
||||||
with the MethodUsageFlags flags, and the method can be obtained with the
|
with the MethodUsageFlags flags, and the method can be obtained with the
|
||||||
CmdMethod function.
|
CmdMethod function.
|
||||||
@ -143,4 +143,4 @@ The second category of errors (type RPCError), on the other hand, are useful for
|
|||||||
returning errors to RPC clients. Consequently, they are used in the previously
|
returning errors to RPC clients. Consequently, they are used in the previously
|
||||||
described Response type.
|
described Response type.
|
||||||
*/
|
*/
|
||||||
package btcjson
|
package btcjson
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
AccountBalanceNtfnMethod = "accountbalance"
|
AccountBalanceNtfnMethod = "accountbalance"
|
||||||
|
|
||||||
// BtcdConnectedNtfnMethod is the method used for notifications when
|
// BtcdConnectedNtfnMethod is the method used for notifications when
|
||||||
// a wallet server is connected to a chain server.
|
// a wallet server is connected to a dag server.
|
||||||
BtcdConnectedNtfnMethod = "btcdconnected"
|
BtcdConnectedNtfnMethod = "btcdconnected"
|
||||||
|
|
||||||
// WalletLockStateNtfnMethod is the method used to notify the lock state
|
// WalletLockStateNtfnMethod is the method used to notify the lock state
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/daglabs/btcd/btcjson"
|
"github.com/daglabs/btcd/btcjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestWalletSvrWsNtfns tests all of the chain server websocket-specific
|
// TestWalletSvrWsNtfns tests all of the dag server websocket-specific
|
||||||
// notifications marshal and unmarshal into valid results include handling of
|
// notifications marshal and unmarshal into valid results include handling of
|
||||||
// optional fields being omitted in the marshalled command, while optional
|
// optional fields being omitted in the marshalled command, while optional
|
||||||
// fields with defaults have the default assigned on unmarshalled commands.
|
// fields with defaults have the default assigned on unmarshalled commands.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user