btcjson: Implement addwitnessaddress functionality.
This commit is contained in:
parent
63d1550d42
commit
91e5ba1a80
2 changed files with 27 additions and 0 deletions
|
@ -27,6 +27,19 @@ func NewAddMultisigAddressCmd(nRequired int, keys []string, account *string) *Ad
|
|||
}
|
||||
}
|
||||
|
||||
// AddWitnessAddressCmd defines the addwitnessaddress JSON-RPC command.
|
||||
type AddWitnessAddressCmd struct {
|
||||
Address string
|
||||
}
|
||||
|
||||
// NewAddWitnessAddressCmd returns a new instance which can be used to issue a
|
||||
// addwitnessaddress JSON-RPC command.
|
||||
func NewAddWitnessAddressCmd(address string) *AddWitnessAddressCmd {
|
||||
return &AddWitnessAddressCmd{
|
||||
Address: address,
|
||||
}
|
||||
}
|
||||
|
||||
// CreateMultisigCmd defines the createmultisig JSON-RPC command.
|
||||
type CreateMultisigCmd struct {
|
||||
NRequired int
|
||||
|
@ -645,6 +658,7 @@ func init() {
|
|||
flags := UFWalletOnly
|
||||
|
||||
MustRegisterCmd("addmultisigaddress", (*AddMultisigAddressCmd)(nil), flags)
|
||||
MustRegisterCmd("addwitnessaddress", (*AddWitnessAddressCmd)(nil), flags)
|
||||
MustRegisterCmd("createmultisig", (*CreateMultisigCmd)(nil), flags)
|
||||
MustRegisterCmd("dumpprivkey", (*DumpPrivKeyCmd)(nil), flags)
|
||||
MustRegisterCmd("encryptwallet", (*EncryptWalletCmd)(nil), flags)
|
||||
|
|
|
@ -61,6 +61,19 @@ func TestWalletSvrCmds(t *testing.T) {
|
|||
Account: btcjson.String("test"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "addwitnessaddress",
|
||||
newCmd: func() (interface{}, error) {
|
||||
return btcjson.NewCmd("addwitnessaddress", "1address")
|
||||
},
|
||||
staticCmd: func() interface{} {
|
||||
return btcjson.NewAddWitnessAddressCmd("1address")
|
||||
},
|
||||
marshalled: `{"jsonrpc":"1.0","method":"addwitnessaddress","params":["1address"],"id":1}`,
|
||||
unmarshalled: &btcjson.AddWitnessAddressCmd{
|
||||
Address: "1address",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "createmultisig",
|
||||
newCmd: func() (interface{}, error) {
|
||||
|
|
Loading…
Add table
Reference in a new issue