Skip to content

Commit

Permalink
btcsuite merge
Browse files Browse the repository at this point in the history
  • Loading branch information
mably committed May 6, 2015
2 parents 36c3255 + a40058c commit a822308
Show file tree
Hide file tree
Showing 33 changed files with 5,280 additions and 6,575 deletions.
77 changes: 77 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,83 @@ User visible changes for btcd
A full-node bitcoin implementation written in Go
============================================================================

Changes in 0.11.0 (Wed May 06 2015)
- Protocol and network related changes:
- **IMPORTANT: Update is required due to the following point**
- Correct a few corner cases in script handling which could result in
forking from the network on non-standard transactions (#425)
- Add a new checkpoint at block height 352940 (#418)
- Optimized script execution (#395, #400, #404, #409)
- Fix a case that could lead stalled syncs (#138, #296)
- Network address manager changes:
- Implement eclipse attack countermeasures as proposed in
http://cs-people.bu.edu/heilman/eclipse (#370, #373)
- Optional address indexing changes:
- Fix an issue where a reorg could cause an orderly shutdown when the
address index is active (#340, #357)
- Transaction relay (memory pool) changes:
- Increase maximum allowed space for nulldata transactions to 80 bytes
(#331)
- Implement support for the following rules specified by BIP0062:
- The S value in ECDSA signature must be at most half the curve order
(rule 5) (#349)
- Script execution must result in a single non-zero value on the stack
(rule 6) (#347)
- NOTE: All 7 rules of BIP0062 are now implemented
- Use network adjusted time in finalized transaction checks to improve
consistency across nodes (#332)
- Process orphan transactions on acceptance of new transactions (#345)
- RPC changes:
- Add support for a limited RPC user which is not allowed admin level
operations on the server (#363)
- Implement node command for more unified control over connected peers
(#79, #341)
- Implement generate command for regtest/simnet to support
deterministically mining a specified number of blocks (#362, #407)
- Update searchrawtransactions to return the matching transactions in
order (#354)
- Correct an issue with searchrawtransactions where it could return
duplicates (#346, #354)
- Increase precision of 'difficulty' field in getblock result to 8
(#414, #415)
- Omit 'nextblockhash' field from getblock result when it is empty
(#416, #417)
- Add 'id' and 'timeoffset' fields to getpeerinfo result (#335)
- Websocket changes:
- Implement new commands stopnotifyspent, stopnotifyreceived,
stopnotifyblocks, and stopnotifynewtransactions to allow clients to
cancel notification registrations (#122, #342)
- btcctl utility changes:
- A single dash can now be used as an argument to cause that argument to
be read from stdin (#348)
- Add generate command
- Notable developer-related package changes:
- The new version 2 btcjson package has now replaced the deprecated
version 1 package (#368)
- The btcec package now performs all signing using RFC6979 deterministic
signatures (#358, #360)
- The txscript package has been significantly cleaned up and had a few
API changes (#387, #388, #389, #390, #391, #392, #393, #395, #396,
#400, #403, #404, #405, #406, #408, #409, #410, #412)
- A new PkScriptLocs function has been added to the wire package MsgTx
type which provides callers that deal with scripts optimization
opportunities (#343)
- Misc changes:
- Minor wire hashing optimizations (#366, #367)
- Other minor internal optimizations
- Contributors (alphabetical order):
- Alex Akselrod
- Arne Brutschy
- Chris Jepson
- Daniel Krawisz
- Dave Collins
- David Hill
- Jimmy Song
- Jonas Nick
- Josh Rickmar
- Olaoluwa Osuntokun
- Oleg Andreev

Changes in 0.10.0 (Sun Mar 01 2015)
- Protocol and network related changes:
- Add a new checkpoint at block height 343185
Expand Down
14 changes: 14 additions & 0 deletions btcjson/btcdextcmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ func NewDebugLevelCmd(levelSpec string) *DebugLevelCmd {
}
}

// GenerateCmd defines the generate JSON-RPC command.
type GenerateCmd struct {
NumBlocks uint32
}

// NewGenerateCmd returns a new instance which can be used to issue a generate
// JSON-RPC command.
func NewGenerateCmd(numBlocks uint32) *GenerateCmd {
return &GenerateCmd{
NumBlocks: numBlocks,
}
}

// GetBestBlockCmd defines the getbestblock JSON-RPC command.
type GetBestBlockCmd struct{}

Expand All @@ -82,6 +95,7 @@ func init() {

MustRegisterCmd("debuglevel", (*DebugLevelCmd)(nil), flags)
MustRegisterCmd("node", (*NodeCmd)(nil), flags)
MustRegisterCmd("generate", (*GenerateCmd)(nil), flags)
MustRegisterCmd("getbestblock", (*GetBestBlockCmd)(nil), flags)
MustRegisterCmd("getcurrentnet", (*GetCurrentNetCmd)(nil), flags)
}
13 changes: 13 additions & 0 deletions btcjson/btcdextcmds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ func TestBtcdExtCmds(t *testing.T) {
ConnectSubCmd: btcjson.String("temp"),
},
},
{
name: "generate",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("generate", 1)
},
staticCmd: func() interface{} {
return btcjson.NewGenerateCmd(1)
},
marshalled: `{"jsonrpc":"1.0","method":"generate","params":[1],"id":1}`,
unmarshalled: &btcjson.GenerateCmd{
NumBlocks: 1,
},
},
{
name: "getbestblock",
newCmd: func() (interface{}, error) {
Expand Down
2 changes: 1 addition & 1 deletion btcjson/chainsvrresults.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ type TxRawResult struct {
Vin []Vin `json:"vin"`
Vout []Vout `json:"vout"`
BlockHash string `json:"blockhash,omitempty"`
Confirmations uint64 `json:"confirmations"`
Confirmations uint64 `json:"confirmations,omitempty"`
Time int64 `json:"time,omitempty"`
Blocktime int64 `json:"blocktime,omitempty"`
}
Expand Down
51 changes: 51 additions & 0 deletions btcjson/chainsvrwscmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ func NewNotifyBlocksCmd() *NotifyBlocksCmd {
return &NotifyBlocksCmd{}
}

// StopNotifyBlocksCmd defines the stopnotifyblocks JSON-RPC command.
type StopNotifyBlocksCmd struct{}

// NewStopNotifyBlocksCmd returns a new instance which can be used to issue a
// stopnotifyblocks JSON-RPC command.
func NewStopNotifyBlocksCmd() *StopNotifyBlocksCmd {
return &StopNotifyBlocksCmd{}
}

// NotifyNewTransactionsCmd defines the notifynewtransactions JSON-RPC command.
type NotifyNewTransactionsCmd struct {
Verbose *bool `jsonrpcdefault:"false"`
Expand All @@ -47,6 +56,18 @@ func NewNotifyNewTransactionsCmd(verbose *bool) *NotifyNewTransactionsCmd {
}
}

// StopNotifyNewTransactionsCmd defines the stopnotifynewtransactions JSON-RPC command.
type StopNotifyNewTransactionsCmd struct{}

// NewStopNotifyNewTransactionsCmd returns a new instance which can be used to issue
// a stopnotifynewtransactions JSON-RPC command.
//
// The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value.
func NewStopNotifyNewTransactionsCmd() *StopNotifyNewTransactionsCmd {
return &StopNotifyNewTransactionsCmd{}
}

// NotifyReceivedCmd defines the notifyreceived JSON-RPC command.
type NotifyReceivedCmd struct {
Addresses []string
Expand Down Expand Up @@ -80,6 +101,32 @@ func NewNotifySpentCmd(outPoints []OutPoint) *NotifySpentCmd {
}
}

// StopNotifyReceivedCmd defines the stopnotifyreceived JSON-RPC command.
type StopNotifyReceivedCmd struct {
Addresses []string
}

// NewStopNotifyReceivedCmd returns a new instance which can be used to issue a
// stopnotifyreceived JSON-RPC command.
func NewStopNotifyReceivedCmd(addresses []string) *StopNotifyReceivedCmd {
return &StopNotifyReceivedCmd{
Addresses: addresses,
}
}

// StopNotifySpentCmd defines the stopnotifyspent JSON-RPC command.
type StopNotifySpentCmd struct {
OutPoints []OutPoint
}

// NewStopNotifySpentCmd returns a new instance which can be used to issue a
// stopnotifyspent JSON-RPC command.
func NewStopNotifySpentCmd(outPoints []OutPoint) *StopNotifySpentCmd {
return &StopNotifySpentCmd{
OutPoints: outPoints,
}
}

// RescanCmd defines the rescan JSON-RPC command.
type RescanCmd struct {
BeginBlock string
Expand Down Expand Up @@ -111,5 +158,9 @@ func init() {
MustRegisterCmd("notifynewtransactions", (*NotifyNewTransactionsCmd)(nil), flags)
MustRegisterCmd("notifyreceived", (*NotifyReceivedCmd)(nil), flags)
MustRegisterCmd("notifyspent", (*NotifySpentCmd)(nil), flags)
MustRegisterCmd("stopnotifyblocks", (*StopNotifyBlocksCmd)(nil), flags)
MustRegisterCmd("stopnotifynewtransactions", (*StopNotifyNewTransactionsCmd)(nil), flags)
MustRegisterCmd("stopnotifyspent", (*StopNotifySpentCmd)(nil), flags)
MustRegisterCmd("stopnotifyreceived", (*StopNotifyReceivedCmd)(nil), flags)
MustRegisterCmd("rescan", (*RescanCmd)(nil), flags)
}
49 changes: 49 additions & 0 deletions btcjson/chainsvrwscmds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ func TestChainSvrWsCmds(t *testing.T) {
marshalled: `{"jsonrpc":"1.0","method":"notifyblocks","params":[],"id":1}`,
unmarshalled: &btcjson.NotifyBlocksCmd{},
},
{
name: "stopnotifyblocks",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("stopnotifyblocks")
},
staticCmd: func() interface{} {
return btcjson.NewStopNotifyBlocksCmd()
},
marshalled: `{"jsonrpc":"1.0","method":"stopnotifyblocks","params":[],"id":1}`,
unmarshalled: &btcjson.StopNotifyBlocksCmd{},
},
{
name: "notifynewtransactions",
newCmd: func() (interface{}, error) {
Expand All @@ -77,6 +88,17 @@ func TestChainSvrWsCmds(t *testing.T) {
Verbose: btcjson.Bool(true),
},
},
{
name: "stopnotifynewtransactions",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("stopnotifynewtransactions")
},
staticCmd: func() interface{} {
return btcjson.NewStopNotifyNewTransactionsCmd()
},
marshalled: `{"jsonrpc":"1.0","method":"stopnotifynewtransactions","params":[],"id":1}`,
unmarshalled: &btcjson.StopNotifyNewTransactionsCmd{},
},
{
name: "notifyreceived",
newCmd: func() (interface{}, error) {
Expand All @@ -90,6 +112,19 @@ func TestChainSvrWsCmds(t *testing.T) {
Addresses: []string{"1Address"},
},
},
{
name: "stopnotifyreceived",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("stopnotifyreceived", []string{"1Address"})
},
staticCmd: func() interface{} {
return btcjson.NewStopNotifyReceivedCmd([]string{"1Address"})
},
marshalled: `{"jsonrpc":"1.0","method":"stopnotifyreceived","params":[["1Address"]],"id":1}`,
unmarshalled: &btcjson.StopNotifyReceivedCmd{
Addresses: []string{"1Address"},
},
},
{
name: "notifyspent",
newCmd: func() (interface{}, error) {
Expand All @@ -104,6 +139,20 @@ func TestChainSvrWsCmds(t *testing.T) {
OutPoints: []btcjson.OutPoint{{Hash: "123", Index: 0}},
},
},
{
name: "stopnotifyspent",
newCmd: func() (interface{}, error) {
return btcjson.NewCmd("stopnotifyspent", `[{"hash":"123","index":0}]`)
},
staticCmd: func() interface{} {
ops := []btcjson.OutPoint{{Hash: "123", Index: 0}}
return btcjson.NewStopNotifySpentCmd(ops)
},
marshalled: `{"jsonrpc":"1.0","method":"stopnotifyspent","params":[[{"hash":"123","index":0}]],"id":1}`,
unmarshalled: &btcjson.StopNotifySpentCmd{
OutPoints: []btcjson.OutPoint{{Hash: "123", Index: 0}},
},
},
{
name: "rescan",
newCmd: func() (interface{}, error) {
Expand Down
2 changes: 1 addition & 1 deletion btcjson/chainsvrwsntfns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func TestChainSvrWsNtfns(t *testing.T) {
}
return btcjson.NewTxAcceptedVerboseNtfn(txResult)
},
marshalled: `{"jsonrpc":"1.0","method":"txacceptedverbose","params":[{"hex":"001122","txid":"123","version":1,"locktime":4294967295,"vin":null,"vout":null,"confirmations":0}],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"txacceptedverbose","params":[{"hex":"001122","txid":"123","version":1,"locktime":4294967295,"vin":null,"vout":null}],"id":null}`,
unmarshalled: &btcjson.TxAcceptedVerboseNtfn{
RawTx: btcjson.TxRawResult{
Hex: "001122",
Expand Down
8 changes: 8 additions & 0 deletions btcjson/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ func Uint64(v uint64) *uint64 {
return p
}

// Float64 is a helper routine that allocates a new float64 value to store v and
// returns a pointer to it. This is useful when assigning optional parameters.
func Float64(v float64) *float64 {
p := new(float64)
*p = v
return p
}

// String is a helper routine that allocates a new string value to store v and
// returns a pointer to it. This is useful when assigning optional parameters.
func String(v string) *string {
Expand Down
50 changes: 29 additions & 21 deletions btcjson/walletsvrresults.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@
package btcjson

// GetTransactionDetailsResult models the details data from the gettransaction command.
//
// This models the "short" version of the ListTransactionsResult type, which
// excludes fields common to the transaction. These common fields are instead
// part of the GetTransactionResult.
type GetTransactionDetailsResult struct {
Account string `json:"account"`
Address string `json:"address,omitempty"`
Category string `json:"category"`
Amount float64 `json:"amount"`
Fee float64 `json:"fee,omitempty"`
Account string `json:"account"`
Address string `json:"address,omitempty"`
Amount float64 `json:"amount"`
Category string `json:"category"`
InvolvesWatchOnly bool `json:"involveswatchonly,omitempty"`
Fee *float64 `json:"fee,omitempty"`
Vout uint32 `json:"vout"`
}

// GetTransactionResult models the data from the gettransaction command.
Expand Down Expand Up @@ -53,22 +59,24 @@ type InfoWalletResult struct {

// ListTransactionsResult models the data from the listtransactions command.
type ListTransactionsResult struct {
Account string `json:"account"`
Address string `json:"address,omitempty"`
Category string `json:"category"`
Amount float64 `json:"amount"`
Fee float64 `json:"fee"`
Confirmations int64 `json:"confirmations"`
Generated bool `json:"generated,omitempty"`
BlockHash string `json:"blockhash,omitempty"`
BlockIndex int64 `json:"blockindex,omitempty"`
BlockTime int64 `json:"blocktime,omitempty"`
TxID string `json:"txid"`
WalletConflicts []string `json:"walletconflicts"`
Time int64 `json:"time"`
TimeReceived int64 `json:"timereceived"`
Comment string `json:"comment,omitempty"`
OtherAccount string `json:"otheraccount"`
Account string `json:"account"`
Address string `json:"address,omitempty"`
Amount float64 `json:"amount"`
BlockHash string `json:"blockhash,omitempty"`
BlockIndex *int64 `json:"blockindex,omitempty"`
BlockTime int64 `json:"blocktime,omitempty"`
Category string `json:"category"`
Confirmations int64 `json:"confirmations"`
Fee *float64 `json:"fee,omitempty"`
Generated bool `json:"generated,omitempty"`
InvolvesWatchOnly bool `json:"involveswatchonly,omitempty"`
Time int64 `json:"time"`
TimeReceived int64 `json:"timereceived"`
TxID string `json:"txid"`
Vout uint32 `json:"vout"`
WalletConflicts []string `json:"walletconflicts"`
Comment string `json:"comment,omitempty"`
OtherAccount string `json:"otheraccount,omitempty"`
}

// ListReceivedByAccountResult models the data from the listreceivedbyaccount
Expand Down
Loading

0 comments on commit a822308

Please sign in to comment.